summaryrefslogtreecommitdiff
path: root/src/server/api
diff options
context:
space:
mode:
authorsyuilo <syuilotan@yahoo.co.jp>2018-09-06 04:28:42 +0900
committersyuilo <syuilotan@yahoo.co.jp>2018-09-06 04:28:42 +0900
commitccf8e44acc8b4bcdb19895ce60cd86d699efcbf7 (patch)
treec313e84c98b54934ef0f24922610ff5e0f60a751 /src/server/api
parentImprove welcome page (diff)
parentShow host in local user detail (#2634) (diff)
downloadsharkey-ccf8e44acc8b4bcdb19895ce60cd86d699efcbf7.tar.gz
sharkey-ccf8e44acc8b4bcdb19895ce60cd86d699efcbf7.tar.bz2
sharkey-ccf8e44acc8b4bcdb19895ce60cd86d699efcbf7.zip
Merge branch 'develop' of https://github.com/syuilo/misskey into develop
Diffstat (limited to 'src/server/api')
-rw-r--r--src/server/api/endpoints/notes/global-timeline.ts3
-rw-r--r--src/server/api/endpoints/notes/hybrid-timeline.ts3
-rw-r--r--src/server/api/endpoints/notes/local-timeline.ts3
-rw-r--r--src/server/api/endpoints/notes/timeline.ts3
-rw-r--r--src/server/api/endpoints/users/notes.ts3
5 files changed, 10 insertions, 5 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';
}
diff --git a/src/server/api/endpoints/notes/hybrid-timeline.ts b/src/server/api/endpoints/notes/hybrid-timeline.ts
index 16cec86797..0eb7b61830 100644
--- a/src/server/api/endpoints/notes/hybrid-timeline.ts
+++ b/src/server/api/endpoints/notes/hybrid-timeline.ts
@@ -5,6 +5,7 @@ import { getFriends } from '../../common/get-friends';
import { pack } from '../../../../models/note';
import { ILocalUser } from '../../../../models/user';
import getParams from '../../get-params';
+import { countIf } from '../../../../prelude/array';
export const meta = {
desc: {
@@ -86,7 +87,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';
}
diff --git a/src/server/api/endpoints/notes/local-timeline.ts b/src/server/api/endpoints/notes/local-timeline.ts
index ce84b4135a..ff10e6fbaa 100644
--- a/src/server/api/endpoints/notes/local-timeline.ts
+++ b/src/server/api/endpoints/notes/local-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: {
@@ -48,7 +49,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';
}
diff --git a/src/server/api/endpoints/notes/timeline.ts b/src/server/api/endpoints/notes/timeline.ts
index 089e7a182a..5f3844987c 100644
--- a/src/server/api/endpoints/notes/timeline.ts
+++ b/src/server/api/endpoints/notes/timeline.ts
@@ -5,6 +5,7 @@ import { getFriends } from '../../common/get-friends';
import { pack } from '../../../../models/note';
import { ILocalUser } from '../../../../models/user';
import getParams from '../../get-params';
+import { countIf } from '../../../../prelude/array';
export const meta = {
desc: {
@@ -86,7 +87,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';
}
diff --git a/src/server/api/endpoints/users/notes.ts b/src/server/api/endpoints/users/notes.ts
index 42c31189d6..1ab7786a18 100644
--- a/src/server/api/endpoints/users/notes.ts
+++ b/src/server/api/endpoints/users/notes.ts
@@ -3,6 +3,7 @@ import getHostLower from '../../common/get-host-lower';
import Note, { pack } from '../../../../models/note';
import User, { ILocalUser } from '../../../../models/user';
import getParams from '../../get-params';
+import { countIf } from '../../../../prelude/array';
export const meta = {
desc: {
@@ -110,7 +111,7 @@ export default (params: any, me: ILocalUser) => new Promise(async (res, rej) =>
}
// 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';
}