summaryrefslogtreecommitdiff
path: root/src/server/api/endpoints/notes/global-timeline.ts
diff options
context:
space:
mode:
authorAya Morisawa <AyaMorisawa4869@gmail.com>2018-09-06 02:16:08 +0900
committersyuilo <Syuilotan@yahoo.co.jp>2018-09-06 02:16:08 +0900
commit395cfa61089efc4ab3ea1b6c6842521bad31efed (patch)
treeac26edc74619d701276f3e127c966878da807d5c /src/server/api/endpoints/notes/global-timeline.ts
parent互換性のためのコードを追加 & #2623 (diff)
downloadsharkey-395cfa61089efc4ab3ea1b6c6842521bad31efed.tar.gz
sharkey-395cfa61089efc4ab3ea1b6c6842521bad31efed.tar.bz2
sharkey-395cfa61089efc4ab3ea1b6c6842521bad31efed.zip
Resolve #2625 (#2627)
Diffstat (limited to 'src/server/api/endpoints/notes/global-timeline.ts')
-rw-r--r--src/server/api/endpoints/notes/global-timeline.ts3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/server/api/endpoints/notes/global-timeline.ts b/src/server/api/endpoints/notes/global-timeline.ts
index e70fc5d76f..5d93cd78ec 100644
--- a/src/server/api/endpoints/notes/global-timeline.ts
+++ b/src/server/api/endpoints/notes/global-timeline.ts
@@ -4,6 +4,7 @@ import Mute from '../../../../models/mute';
import { pack } from '../../../../models/note';
import { ILocalUser } from '../../../../models/user';
import getParams from '../../get-params';
+import { countIf } from '../../../../prelude/array';
export const meta = {
desc: {
@@ -42,7 +43,7 @@ export default async (params: any, user: ILocalUser) => {
if (psErr) throw psErr;
// Check if only one of sinceId, untilId, sinceDate, untilDate specified
- if ([ps.sinceId, ps.untilId, ps.sinceDate, ps.untilDate].filter(x => x != null).length > 1) {
+ if (countIf(x => x != null, [ps.sinceId, ps.untilId, ps.sinceDate, ps.untilDate]) > 1) {
throw 'only one of sinceId, untilId, sinceDate, untilDate can be specified';
}