fix
This commit is contained in:
@@ -14,7 +14,7 @@ import serialize from '../../serializers/post';
|
||||
*/
|
||||
module.exports = (params, user) => new Promise(async (res, rej) => {
|
||||
// Get 'post_id' parameter
|
||||
const [postId, postIdErr] = it(params.post_id, 'id', true);
|
||||
const [postId, postIdErr] = it(params.post_id, 'id!').get();
|
||||
if (postIdErr) return rej('invalid post_id param');
|
||||
|
||||
// Get 'limit' parameter
|
||||
|
@@ -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');
|
||||
}
|
||||
|
||||
|
@@ -14,7 +14,7 @@ import Post from '../../../models/post';
|
||||
*/
|
||||
module.exports = (params, user) => new Promise(async (res, rej) => {
|
||||
// Get 'post_id' parameter
|
||||
const [postId, postIdErr] = it(params.post_id, 'id', true);
|
||||
const [postId, postIdErr] = it(params.post_id, 'id!').get();
|
||||
if (postIdErr) return rej('invalid post_id param');
|
||||
|
||||
// Get favoritee
|
||||
|
@@ -14,7 +14,7 @@ import Post from '../../../models/post';
|
||||
*/
|
||||
module.exports = (params, user) => new Promise(async (res, rej) => {
|
||||
// Get 'post_id' parameter
|
||||
const [postId, postIdErr] = it(params.post_id, 'id', true);
|
||||
const [postId, postIdErr] = it(params.post_id, 'id!').get();
|
||||
if (postIdErr) return rej('invalid post_id param');
|
||||
|
||||
// Get favoritee
|
||||
|
@@ -15,7 +15,7 @@ import serialize from '../../serializers/user';
|
||||
*/
|
||||
module.exports = (params, user) => new Promise(async (res, rej) => {
|
||||
// Get 'post_id' parameter
|
||||
const [postId, postIdErr] = it(params.post_id, 'id', true);
|
||||
const [postId, postIdErr] = it(params.post_id, 'id!').get();
|
||||
if (postIdErr) return rej('invalid post_id param');
|
||||
|
||||
// Get 'limit' parameter
|
||||
|
@@ -16,7 +16,7 @@ import notify from '../../../common/notify';
|
||||
*/
|
||||
module.exports = (params, user) => new Promise(async (res, rej) => {
|
||||
// Get 'post_id' parameter
|
||||
const [postId, postIdErr] = it(params.post_id, 'id', true);
|
||||
const [postId, postIdErr] = it(params.post_id, 'id!').get();
|
||||
if (postIdErr) return rej('invalid post_id param');
|
||||
|
||||
// Get likee
|
||||
|
@@ -16,7 +16,7 @@ import User from '../../../models/user';
|
||||
*/
|
||||
module.exports = (params, user) => new Promise(async (res, rej) => {
|
||||
// Get 'post_id' parameter
|
||||
const [postId, postIdErr] = it(params.post_id, 'id', true);
|
||||
const [postId, postIdErr] = it(params.post_id, 'id!').get();
|
||||
if (postIdErr) return rej('invalid post_id param');
|
||||
|
||||
// Get likee
|
||||
|
@@ -15,7 +15,7 @@ import notify from '../../../common/notify';
|
||||
*/
|
||||
module.exports = (params, user) => new Promise(async (res, rej) => {
|
||||
// Get 'post_id' parameter
|
||||
const [postId, postIdErr] = it(params.post_id, 'id', true);
|
||||
const [postId, postIdErr] = it(params.post_id, 'id!').get();
|
||||
if (postIdErr) return rej('invalid post_id param');
|
||||
|
||||
// Get votee
|
||||
|
@@ -14,11 +14,11 @@ import serialize from '../../serializers/post';
|
||||
*/
|
||||
module.exports = (params, user) => new Promise(async (res, rej) => {
|
||||
// Get 'post_id' parameter
|
||||
const [postId, postIdErr] = it(params.post_id, 'id', true);
|
||||
const [postId, postIdErr] = it(params.post_id, 'id!').get();
|
||||
if (postIdErr) return rej('invalid post_id param');
|
||||
|
||||
// Get 'limit' parameter
|
||||
const [limit = 10, limitErr] = it(params.limit).expect.number().range(1, 100)).get();
|
||||
const [limit = 10, limitErr] = it(params.limit).expect.number().range(1, 100).get();
|
||||
if (limitErr) return rej('invalid limit param');
|
||||
|
||||
// Get 'offset' parameter
|
||||
|
@@ -14,7 +14,7 @@ import serialize from '../../serializers/post';
|
||||
*/
|
||||
module.exports = (params, user) => new Promise(async (res, rej) => {
|
||||
// Get 'post_id' parameter
|
||||
const [postId, postIdErr] = it(params.post_id, 'id', true);
|
||||
const [postId, postIdErr] = it(params.post_id, 'id!').get();
|
||||
if (postIdErr) return rej('invalid post_id param');
|
||||
|
||||
// Get 'limit' parameter
|
||||
|
@@ -14,7 +14,7 @@ import serialize from '../../serializers/post';
|
||||
*/
|
||||
module.exports = (params, user) => new Promise(async (res, rej) => {
|
||||
// Get 'post_id' parameter
|
||||
const [postId, postIdErr] = it(params.post_id, 'id', true);
|
||||
const [postId, postIdErr] = it(params.post_id, 'id!').get();
|
||||
if (postIdErr) return rej('invalid post_id param');
|
||||
|
||||
// Get post
|
||||
|
Reference in New Issue
Block a user