Merge pull request #199 from jedahan/content-warning-publish
Add content warning publishing, fixes #191
This commit is contained in:
commit
f70dae3f0e
|
@ -150,6 +150,19 @@ input {
|
|||
border-radius: var(--common-radius);
|
||||
}
|
||||
|
||||
.contentWarning {
|
||||
background-color: var(--bg);
|
||||
box-sizing: border-box;
|
||||
display: block;
|
||||
font-size: var(--whole);
|
||||
padding: var(--whole);
|
||||
width: 100%;
|
||||
margin: var(--whole) 0;
|
||||
border: var(--pico) solid var(--bg-selection);
|
||||
border-radius: var(--common-radius);
|
||||
color: var(--fg);
|
||||
}
|
||||
|
||||
textarea {
|
||||
background-color: var(--bg);
|
||||
box-sizing: border-box;
|
||||
|
|
|
@ -490,16 +490,19 @@ router
|
|||
})
|
||||
.post("/publish/", koaBody(), async ctx => {
|
||||
const text = String(ctx.request.body.text);
|
||||
const publish = async ({ text }) => {
|
||||
const contentWarning = String(ctx.request.body.contentWarning);
|
||||
|
||||
const publish = async ({ text, contentWarning }) => {
|
||||
const mentions =
|
||||
ssbMentions(text).filter(mention => mention != null) || undefined;
|
||||
|
||||
return post.root({
|
||||
text,
|
||||
mentions
|
||||
mentions,
|
||||
contentWarning
|
||||
});
|
||||
};
|
||||
ctx.body = await publish({ text });
|
||||
ctx.body = await publish({ text, contentWarning });
|
||||
ctx.redirect("/");
|
||||
})
|
||||
.post("/follow/:feed", koaBody(), async ctx => {
|
||||
|
|
|
@ -444,6 +444,13 @@ exports.publishView = () => {
|
|||
i18n.publishLabel({ markdownUrl, linkTarget: "_blank" })
|
||||
),
|
||||
textarea({ required: true, name: "text" }),
|
||||
label({ for: "contentWarning" }, i18n.contentWarningLabel),
|
||||
input({
|
||||
name: "contentWarning",
|
||||
type: "text",
|
||||
class: "contentWarning",
|
||||
placeholder: "Optional warning for the post"
|
||||
}),
|
||||
button({ type: "submit" }, i18n.submit)
|
||||
)
|
||||
)
|
||||
|
|
Loading…
Reference in New Issue