From 9fa0b06b78078ccd63f9058621ef84ea4aa0a0b7 Mon Sep 17 00:00:00 2001 From: syuilo Date: Sun, 12 Feb 2017 22:39:23 +0900 Subject: [PATCH] [API] Fix bug --- src/api/endpoints/posts/create.js | 2 -- test/api.js | 13 +++++++++++++ 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/src/api/endpoints/posts/create.js b/src/api/endpoints/posts/create.js index dc73725a7..e7c1d0cec 100644 --- a/src/api/endpoints/posts/create.js +++ b/src/api/endpoints/posts/create.js @@ -53,8 +53,6 @@ module.exports = (params, user, app) => let media = params.media_ids; let files = []; if (media !== undefined && media !== null) { - media = media.split(','); - if (media.length > maxMediaCount) { return rej('too many media'); } diff --git a/test/api.js b/test/api.js index b0aeec0b1..1ba4eb4e8 100644 --- a/test/api.js +++ b/test/api.js @@ -220,6 +220,19 @@ describe('API', () => { }); })); + it('ファイルを添付できる', () => new Promise(async (done) => { + const me = await insertSakurako(); + const file = await insertDriveFile(); + request('/posts/create', { + media_ids: [file._id.toString()] + }, me).then(res => { + res.should.have.status(200); + res.body.should.be.a('object'); + res.body.should.have.property('media_ids').eql([file._id.toString()]); + done(); + }); + })); + it('返信できる', () => new Promise(async (done) => { const hima = await insertHimawari(); const himaPost = await db.get('posts').insert({