From 8e359d54bdd05f6718d8dab28ae19e1d1f657f89 Mon Sep 17 00:00:00 2001 From: Aya Morisawa Date: Thu, 6 Sep 2018 06:06:22 +0900 Subject: [PATCH] if elimination (#2635) --- src/server/api/call.ts | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/server/api/call.ts b/src/server/api/call.ts index e9abc11f5..ee79e0a13 100644 --- a/src/server/api/call.ts +++ b/src/server/api/call.ts @@ -25,10 +25,8 @@ export default (endpoint: string, user: IUser, app: IApp, data: any, file?: any) return rej('YOU_ARE_NOT_ADMIN'); } - if (app && ep.meta.kind) { - if (!app.permission.some(p => p === ep.meta.kind)) { - return rej('PERMISSION_DENIED'); - } + if (app && ep.meta.kind && !app.permission.some(p => p === ep.meta.kind)) { + return rej('PERMISSION_DENIED'); } if (ep.meta.requireCredential && ep.meta.limit) {