This commit is contained in:
Aya Morisawa
2018-09-06 02:16:08 +09:00
committed by syuilo
parent b5ff2abdb9
commit 395cfa6108
9 changed files with 25 additions and 9 deletions

View File

@ -10,6 +10,7 @@ import { setResponseType } from '../activitypub';
import Note from '../../models/note';
import renderNote from '../../remote/activitypub/renderer/note';
import { countIf } from '../../prelude/array';
export default async (ctx: Router.IRouterContext) => {
const userId = new mongo.ObjectID(ctx.params.user);
@ -25,7 +26,7 @@ export default async (ctx: Router.IRouterContext) => {
const page: boolean = ctx.request.query.page === 'true';
// Validate parameters
if (sinceIdErr || untilIdErr || pageErr || [sinceId, untilId].filter(x => x != null).length > 1) {
if (sinceIdErr || untilIdErr || pageErr || countIf(x => x != null, [sinceId, untilId]) > 1) {
ctx.status = 400;
return;
}