From 6951f7e74a0e2ded046854f01e4f259122b81421 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Acid=20Chicken=20=28=E7=A1=AB=E9=85=B8=E9=B6=8F=29?= Date: Thu, 22 Nov 2018 05:06:51 +0900 Subject: [PATCH] Fix #3361 (#3362) * Update create.ts * Update api.ts --- src/server/api/endpoints/notes/create.ts | 2 +- test/api.ts | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/server/api/endpoints/notes/create.ts b/src/server/api/endpoints/notes/create.ts index 4f8d6a4f4f..fd1fb3922c 100644 --- a/src/server/api/endpoints/notes/create.ts +++ b/src/server/api/endpoints/notes/create.ts @@ -219,7 +219,7 @@ export default define(meta, (ps, user, app) => new Promise(async (res, rej) => { } // テキストが無いかつ添付ファイルが無いかつRenoteも無いかつ投票も無かったらエラー - if ((ps.text == null) && files === null && renote === null && ps.poll == null) { + if (!(ps.text || files.length || renote || ps.poll)) { return rej('text, fileIds, renoteId or poll is required'); } diff --git a/test/api.ts b/test/api.ts index 6debea4d12..cb0385c3e7 100644 --- a/test/api.ts +++ b/test/api.ts @@ -314,6 +314,7 @@ describe('API', () => { const file = await uploadFile(bob); const res = await request('/notes/create', { + text: 'test', fileIds: [file.id] }, me); @@ -327,6 +328,7 @@ describe('API', () => { const me = await signup(); const res = await request('/notes/create', { + text: 'test', fileIds: ['000000000000000000000000'] }, me);