Merge pull request #212 from christianbundy/fix-publish

Fix publish not working without content warning
This commit is contained in:
Cinnamon 2020-02-13 18:12:11 -08:00 committed by GitHub
commit 827ed528db
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 1 deletions

View File

@ -490,7 +490,11 @@ router
})
.post("/publish/", koaBody(), async ctx => {
const text = String(ctx.request.body.text);
const contentWarning = String(ctx.request.body.contentWarning);
const rawContentWarning = String(ctx.request.body.contentWarning);
// Only submit content warning if it's a string with non-zero length.
const contentWarning =
rawContentWarning.length > 0 ? rawContentWarning : undefined;
const publish = async ({ text, contentWarning }) => {
const mentions =