summaryrefslogtreecommitdiff
path: root/src/server/api/endpoints/posts/create.ts
diff options
context:
space:
mode:
authorsyuilo <syuilotan@yahoo.co.jp>2018-04-03 17:46:09 +0900
committersyuilo <syuilotan@yahoo.co.jp>2018-04-03 17:46:09 +0900
commit172f11a2a00ceb777e720eebf52dc2c06f1b8cd5 (patch)
tree5328f3e732147434df142390e166d6b32748fd6f /src/server/api/endpoints/posts/create.ts
parentMerge branch 'master' of https://github.com/syuilo/misskey (diff)
downloadsharkey-172f11a2a00ceb777e720eebf52dc2c06f1b8cd5.tar.gz
sharkey-172f11a2a00ceb777e720eebf52dc2c06f1b8cd5.tar.bz2
sharkey-172f11a2a00ceb777e720eebf52dc2c06f1b8cd5.zip
Implement visibility param
Diffstat (limited to 'src/server/api/endpoints/posts/create.ts')
-rw-r--r--src/server/api/endpoints/posts/create.ts5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/server/api/endpoints/posts/create.ts b/src/server/api/endpoints/posts/create.ts
index ccd617545c..03af7ee763 100644
--- a/src/server/api/endpoints/posts/create.ts
+++ b/src/server/api/endpoints/posts/create.ts
@@ -23,6 +23,10 @@ import distribute from '../../../../post/distribute';
* @return {Promise<any>}
*/
module.exports = (params, user: ILocalUser, app) => new Promise(async (res, rej) => {
+ // Get 'visibility' parameter
+ const [visibility = 'public', visibilityErr] = $(params.visibility).optional.string().or(['public', 'unlisted', 'private', 'direct']).$;
+ if (visibilityErr) return rej('invalid visibility');
+
// Get 'text' parameter
const [text, textErr] = $(params.text).optional.string().pipe(isValidText).$;
if (textErr) return rej('invalid text');
@@ -280,6 +284,7 @@ module.exports = (params, user: ILocalUser, app) => new Promise(async (res, rej)
userId: user._id,
appId: app ? app._id : null,
viaMobile: viaMobile,
+ visibility,
geo
}, reply, repost, atMentions);