diff options
| author | syuilo <syuilotan@yahoo.co.jp> | 2018-09-07 00:52:21 +0900 |
|---|---|---|
| committer | syuilo <syuilotan@yahoo.co.jp> | 2018-09-07 00:52:21 +0900 |
| commit | 538bb978edab3cd566c4201674adadc0fd3040df (patch) | |
| tree | d55a4bc74c180f54a55dd60eb7219dd37d809b20 /src/server | |
| parent | Fix bug & some refactor (diff) | |
| parent | Fix typo: serive -> service (#2647) (diff) | |
| download | misskey-538bb978edab3cd566c4201674adadc0fd3040df.tar.gz misskey-538bb978edab3cd566c4201674adadc0fd3040df.tar.bz2 misskey-538bb978edab3cd566c4201674adadc0fd3040df.zip | |
Merge branch 'develop' of https://github.com/syuilo/misskey into develop
Diffstat (limited to 'src/server')
| -rw-r--r-- | src/server/api/endpoints/hashtags/trend.ts | 4 | ||||
| -rw-r--r-- | src/server/api/endpoints/notes/search_by_tag.ts | 9 |
2 files changed, 7 insertions, 6 deletions
diff --git a/src/server/api/endpoints/hashtags/trend.ts b/src/server/api/endpoints/hashtags/trend.ts index 01dfccc71c..e7c08ca9f0 100644 --- a/src/server/api/endpoints/hashtags/trend.ts +++ b/src/server/api/endpoints/hashtags/trend.ts @@ -1,4 +1,5 @@ import Note from '../../../../models/note'; +import { erase } from '../../../../prelude/array'; /* トレンドに載るためには「『直近a分間のユニーク投稿数が今からa分前~今からb分前の間のユニーク投稿数のn倍以上』のハッシュタグの上位5位以内に入る」ことが必要 @@ -85,8 +86,7 @@ export default () => new Promise(async (res, rej) => { //#endregion // タグを人気順に並べ替え - let hots = (await Promise.all(hotsPromises)) - .filter(x => x != null) + let hots = erase(null, await Promise.all(hotsPromises)) .sort((a, b) => b.count - a.count) .map(tag => tag.name) .slice(0, max); diff --git a/src/server/api/endpoints/notes/search_by_tag.ts b/src/server/api/endpoints/notes/search_by_tag.ts index 82f11a9775..77082c2600 100644 --- a/src/server/api/endpoints/notes/search_by_tag.ts +++ b/src/server/api/endpoints/notes/search_by_tag.ts @@ -5,6 +5,7 @@ import Mute from '../../../../models/mute'; import { getFriendIds } from '../../common/get-friends'; import { pack } from '../../../../models/note'; import getParams from '../../get-params'; +import { erase } from '../../../../prelude/array'; export const meta = { desc: { @@ -103,23 +104,23 @@ export default (params: any, me: ILocalUser) => new Promise(async (res, rej) => if (psErr) throw psErr; if (ps.includeUserUsernames != null) { - const ids = (await Promise.all(ps.includeUserUsernames.map(async (username) => { + const ids = erase(null, await Promise.all(ps.includeUserUsernames.map(async (username) => { const _user = await User.findOne({ usernameLower: username.toLowerCase() }); return _user ? _user._id : null; - }))).filter(id => id != null); + }))); ids.forEach(id => ps.includeUserIds.push(id)); } if (ps.excludeUserUsernames != null) { - const ids = (await Promise.all(ps.excludeUserUsernames.map(async (username) => { + const ids = erase(null, await Promise.all(ps.excludeUserUsernames.map(async (username) => { const _user = await User.findOne({ usernameLower: username.toLowerCase() }); return _user ? _user._id : null; - }))).filter(id => id != null); + }))); ids.forEach(id => ps.excludeUserIds.push(id)); } |