[API] Fix bug

This commit is contained in:
syuilo 2017-02-14 14:47:59 +09:00
parent 9651b92819
commit 9c385214bd

View file

@ -174,6 +174,11 @@ module.exports = (params, user, app) =>
return rej('poll choices must be an array');
}
// 選択肢が空の配列でエラー
if (poll.choices.length == 0) {
return rej('poll choices is required');
}
// Validate each choices
const shouldReject = poll.choices.some(choice => {
if (typeof choice !== 'string') return true;