* Update create.ts

* Update api.ts
This commit is contained in:
Acid Chicken (硫酸鶏) 2018-11-22 05:06:51 +09:00 committed by syuilo
parent dee36018fc
commit 863197af59
2 changed files with 3 additions and 1 deletions

View file

@ -219,7 +219,7 @@ export default define(meta, (ps, user, app) => new Promise(async (res, rej) => {
} }
// テキストが無いかつ添付ファイルが無いかつRenoteも無いかつ投票も無かったらエラー // テキストが無いかつ添付ファイルが無いかつ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'); return rej('text, fileIds, renoteId or poll is required');
} }

View file

@ -314,6 +314,7 @@ describe('API', () => {
const file = await uploadFile(bob); const file = await uploadFile(bob);
const res = await request('/notes/create', { const res = await request('/notes/create', {
text: 'test',
fileIds: [file.id] fileIds: [file.id]
}, me); }, me);
@ -327,6 +328,7 @@ describe('API', () => {
const me = await signup(); const me = await signup();
const res = await request('/notes/create', { const res = await request('/notes/create', {
text: 'test',
fileIds: ['000000000000000000000000'] fileIds: ['000000000000000000000000']
}, me); }, me);