summaryrefslogtreecommitdiff
path: root/src/api/endpoints/posts/create.ts
diff options
context:
space:
mode:
authorsyuilo <syuilotan@yahoo.co.jp>2017-03-05 12:09:34 +0900
committersyuilo <syuilotan@yahoo.co.jp>2017-03-05 12:09:34 +0900
commit034c7c083adf5433f1956753cd1b98d54483db4a (patch)
tree2e41ea90e53d1349abf44444c2f1e6b2ec3de783 /src/api/endpoints/posts/create.ts
parentUse cafy (diff)
downloadsharkey-034c7c083adf5433f1956753cd1b98d54483db4a.tar.gz
sharkey-034c7c083adf5433f1956753cd1b98d54483db4a.tar.bz2
sharkey-034c7c083adf5433f1956753cd1b98d54483db4a.zip
fix
Diffstat (limited to 'src/api/endpoints/posts/create.ts')
-rw-r--r--src/api/endpoints/posts/create.ts10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/api/endpoints/posts/create.ts b/src/api/endpoints/posts/create.ts
index 3737012a30..80a8e57e62 100644
--- a/src/api/endpoints/posts/create.ts
+++ b/src/api/endpoints/posts/create.ts
@@ -88,20 +88,20 @@ module.exports = (params, user, app) => new Promise(async (res, rej) => {
if (latestPost &&
latestPost.repost_id &&
latestPost.repost_id.equals(repost._id) &&
- text === null && files === null) {
+ text === undefined && files === null) {
return rej('二重Repostです(NEED TRANSLATE)');
}
// 直近がRepost対象かつ引用じゃなかったらエラー
if (latestPost &&
latestPost._id.equals(repost._id) &&
- text === null && files === null) {
+ text === undefined && files === null) {
return rej('二重Repostです(NEED TRANSLATE)');
}
}
// Get 'in_reply_to_post_id' parameter
- const [inReplyToPostId, inReplyToPostIdErr] = it(params.reply_to_id, 'id');
+ const [inReplyToPostId, inReplyToPostIdErr] = it(params.reply_to_id, 'id').get();
if (inReplyToPostIdErr) return rej('invalid in_reply_to_post_id');
let inReplyToPost = null;
@@ -122,7 +122,7 @@ module.exports = (params, user, app) => new Promise(async (res, rej) => {
}
// Get 'poll' parameter
- const [_poll, pollErr] = it(params.poll, 'object');
+ const [_poll, pollErr] = it(params.poll, 'object').get();
if (pollErr) return rej('invalid poll');
let poll = null;
@@ -151,7 +151,7 @@ module.exports = (params, user, app) => new Promise(async (res, rej) => {
}
// テキストが無いかつ添付ファイルが無いかつRepostも無いかつ投票も無かったらエラー
- if (text === null && files === null && repost === null && poll === null) {
+ if (text === undefined && files === null && repost === null && poll === null) {
return rej('text, media_ids, repost_id or poll is required');
}