summaryrefslogtreecommitdiff
path: root/src/api/endpoints/posts
diff options
context:
space:
mode:
authorsyuilo <syuilotan@yahoo.co.jp>2017-03-06 03:50:27 +0900
committersyuilo <syuilotan@yahoo.co.jp>2017-03-06 03:50:27 +0900
commit79c264171d69992ce76f4ceec2bd03b0e5faaac3 (patch)
tree184d909156a10bb073376f3d89cd548648f48bda /src/api/endpoints/posts
parentMerge pull request #235 from syuilo/greenkeeper/cafy-1.0.1 (diff)
downloadsharkey-79c264171d69992ce76f4ceec2bd03b0e5faaac3.tar.gz
sharkey-79c264171d69992ce76f4ceec2bd03b0e5faaac3.tar.bz2
sharkey-79c264171d69992ce76f4ceec2bd03b0e5faaac3.zip
[]API Fix bugs
Diffstat (limited to 'src/api/endpoints/posts')
-rw-r--r--src/api/endpoints/posts/create.ts7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/api/endpoints/posts/create.ts b/src/api/endpoints/posts/create.ts
index 80a8e57e62..7f952e83be 100644
--- a/src/api/endpoints/posts/create.ts
+++ b/src/api/endpoints/posts/create.ts
@@ -2,7 +2,7 @@
* Module dependencies
*/
import it from 'cafy';
-import parse from '../../../common/text';
+const parse = require('../../../common/text');
import Post from '../../models/post';
import { isValidText } from '../../models/post';
import User from '../../models/user';
@@ -128,10 +128,11 @@ module.exports = (params, user, app) => new Promise(async (res, rej) => {
let poll = null;
if (_poll !== undefined) {
const [pollChoices, pollChoicesErr] =
- it(params.poll).expect.array()
+ it(params.poll.choices).expect.array()
+ .required()
.unique()
.allString()
- .range(1, 10)
+ .range(2, 10)
.validate(choices => !choices.some(choice => {
if (typeof choice != 'string') return true;
if (choice.trim().length == 0) return true;