From 3db414add43e6e5e449d490a84783d61f86c1d61 Mon Sep 17 00:00:00 2001 From: Aya Morisawa Date: Fri, 30 Nov 2018 23:30:28 +0900 Subject: [PATCH] Use for-of instead of map return values are not being used --- src/services/i/pin.ts | 4 ++-- src/services/i/update.ts | 4 ++-- src/services/note/create.ts | 6 +++--- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/services/i/pin.ts b/src/services/i/pin.ts index 1544b0fdc7..bcd5465c04 100644 --- a/src/services/i/pin.ts +++ b/src/services/i/pin.ts @@ -117,14 +117,14 @@ async function CreateRemoteInboxes(user: ILocalUser): Promise { const queue: string[] = []; - followers.map(following => { + for (const following of followers) { const follower = following._follower; if (isRemoteUser(follower)) { const inbox = follower.sharedInbox || follower.inbox; if (!queue.includes(inbox)) queue.push(inbox); } - }); + } return queue; } diff --git a/src/services/i/update.ts b/src/services/i/update.ts index 25b55b0355..3d17c07963 100644 --- a/src/services/i/update.ts +++ b/src/services/i/update.ts @@ -19,14 +19,14 @@ export async function publishToFollowers(userId: mongo.ObjectID) { // フォロワーがリモートユーザーかつ投稿者がローカルユーザーならUpdateを配信 if (isLocalUser(user)) { - followers.map(following => { + for (const following of followers) { const follower = following._follower; if (isRemoteUser(follower)) { const inbox = follower.sharedInbox || follower.inbox; if (!queue.includes(inbox)) queue.push(inbox); } - }); + } if (queue.length > 0) { const content = packAp(renderUpdate(await renderPerson(user), user)); diff --git a/src/services/note/create.ts b/src/services/note/create.ts index 5e4dfd22ea..99cf14ecfa 100644 --- a/src/services/note/create.ts +++ b/src/services/note/create.ts @@ -201,7 +201,7 @@ export default async (user: IUser, data: Option, silent = false) => new Promise< } // ハッシュタグ登録 - tags.map(tag => registerHashtag(user, tag)); + for (const tag of tags) registerHashtag(user, tag); // ファイルが添付されていた場合ドライブのファイルの「このファイルが添付された投稿一覧」プロパティにこの投稿を追加 if (data.files) { @@ -562,7 +562,7 @@ async function publishToFollowers(note: INote, user: IUser, noteActivity: any) { const queue: string[] = []; - followers.map(following => { + for (const following of followers) { const follower = following._follower; if (isLocalUser(follower)) { @@ -586,7 +586,7 @@ async function publishToFollowers(note: INote, user: IUser, noteActivity: any) { if (!queue.includes(inbox)) queue.push(inbox); } } - }); + } queue.forEach(inbox => { deliver(user as any, noteActivity, inbox);