diff options
| author | syuilo <Syuilotan@yahoo.co.jp> | 2019-02-22 11:46:58 +0900 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2019-02-22 11:46:58 +0900 |
| commit | 2756f553c68082342a784ef716c62da6cea6f3ca (patch) | |
| tree | 1e0364ca9ddc1fd88e311f0687746f44e007effd /src/server/api/endpoints/notes/timeline.ts | |
| parent | Update CHANGELOG.md (diff) | |
| download | misskey-2756f553c68082342a784ef716c62da6cea6f3ca.tar.gz misskey-2756f553c68082342a784ef716c62da6cea6f3ca.tar.bz2 misskey-2756f553c68082342a784ef716c62da6cea6f3ca.zip | |
Improve error handling of API (#4345)
* wip
* wip
* wip
* Update attached_notes.ts
* wip
* Refactor
* wip
* wip
* wip
* wip
* wip
* wip
* wip
* wip
* Update call.ts
* wip
* wip
* wip
* wip
* wip
* wip
* wip
* wip
* wip
* wip
* wip
* wip
* wip
* wip
* wip
* wip
* :v:
* Fix
Diffstat (limited to 'src/server/api/endpoints/notes/timeline.ts')
| -rw-r--r-- | src/server/api/endpoints/notes/timeline.ts | 26 |
1 files changed, 8 insertions, 18 deletions
diff --git a/src/server/api/endpoints/notes/timeline.ts b/src/server/api/endpoints/notes/timeline.ts index aff3ec8cb6..cb6900a10b 100644 --- a/src/server/api/endpoints/notes/timeline.ts +++ b/src/server/api/endpoints/notes/timeline.ts @@ -4,7 +4,6 @@ import Note from '../../../../models/note'; import { getFriends } from '../../common/get-friends'; import { packMany } from '../../../../models/note'; import define from '../../define'; -import { countIf } from '../../../../prelude/array'; import activeUsersChart from '../../../../services/chart/active-users'; import { getHideUserIds } from '../../common/get-hide-users'; @@ -95,13 +94,7 @@ export const meta = { } }; -export default define(meta, (ps, user) => new Promise(async (res, rej) => { - // Check if only one of sinceId, untilId, sinceDate, untilDate specified - if (countIf(x => x != null, [ps.sinceId, ps.untilId, ps.sinceDate, ps.untilDate]) > 1) { - rej('only one of sinceId, untilId, sinceDate, untilDate can be specified'); - return; - } - +export default define(meta, async (ps, user) => { const [followings, hideUserIds] = await Promise.all([ // フォローを取得 // Fetch following @@ -255,15 +248,12 @@ export default define(meta, (ps, user) => new Promise(async (res, rej) => { } //#endregion - // Issue query - const timeline = await Note - .find(query, { - limit: ps.limit, - sort: sort - }); - - // Serialize - res(await packMany(timeline, user)); + const timeline = await Note.find(query, { + limit: ps.limit, + sort: sort + }); activeUsersChart.update(user); -})); + + return await packMany(timeline, user); +}); |