diff options
| author | syuilo <syuilotan@yahoo.co.jp> | 2018-03-30 11:24:07 +0900 |
|---|---|---|
| committer | syuilo <syuilotan@yahoo.co.jp> | 2018-03-30 11:24:07 +0900 |
| commit | 75c4c844e6d679cd94da59525801fdd879e780c1 (patch) | |
| tree | afbba7da50f7af3106e3e8d15e53ced1f726c041 /src/server | |
| parent | Update user.ts (diff) | |
| download | sharkey-75c4c844e6d679cd94da59525801fdd879e780c1.tar.gz sharkey-75c4c844e6d679cd94da59525801fdd879e780c1.tar.bz2 sharkey-75c4c844e6d679cd94da59525801fdd879e780c1.zip | |
cw
Diffstat (limited to 'src/server')
| -rw-r--r-- | src/server/api/endpoints/posts/create.ts | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/server/api/endpoints/posts/create.ts b/src/server/api/endpoints/posts/create.ts index 6b2957ae67..170b667191 100644 --- a/src/server/api/endpoints/posts/create.ts +++ b/src/server/api/endpoints/posts/create.ts @@ -4,7 +4,7 @@ import $ from 'cafy'; import deepEqual = require('deep-equal'); import parse from '../../../../common/text'; -import { default as Post, IPost, isValidText } from '../../../../models/post'; +import { default as Post, IPost, isValidText, isValidCw } from '../../../../models/post'; import { default as User, ILocalAccount, IUser } from '../../../../models/user'; import { default as Channel, IChannel } from '../../../../models/channel'; import Following from '../../../../models/following'; @@ -33,6 +33,10 @@ module.exports = (params, user: IUser, app) => new Promise(async (res, rej) => { const [text, textErr] = $(params.text).optional.string().pipe(isValidText).$; if (textErr) return rej('invalid text'); + // Get 'cw' parameter + const [cw, cwErr] = $(params.cw).optional.string().pipe(isValidCw).$; + if (cwErr) return rej('invalid cw'); + // Get 'viaMobile' parameter const [viaMobile = false, viaMobileErr] = $(params.viaMobile).optional.boolean().$; if (viaMobileErr) return rej('invalid viaMobile'); @@ -255,6 +259,7 @@ module.exports = (params, user: IUser, app) => new Promise(async (res, rej) => { repostId: repost ? repost._id : undefined, poll: poll, text: text, + cw: cw, tags: tags, userId: user._id, appId: app ? app._id : null, |