Use for-of instead of map

return values are not being used
This commit is contained in:
Aya Morisawa 2018-11-30 23:30:28 +09:00
parent 9ef641b403
commit 3db414add4
No known key found for this signature in database
GPG key ID: 3E64865D70D579F2
3 changed files with 7 additions and 7 deletions

View file

@ -117,14 +117,14 @@ async function CreateRemoteInboxes(user: ILocalUser): Promise<string[]> {
const queue: string[] = []; const queue: string[] = [];
followers.map(following => { for (const following of followers) {
const follower = following._follower; const follower = following._follower;
if (isRemoteUser(follower)) { if (isRemoteUser(follower)) {
const inbox = follower.sharedInbox || follower.inbox; const inbox = follower.sharedInbox || follower.inbox;
if (!queue.includes(inbox)) queue.push(inbox); if (!queue.includes(inbox)) queue.push(inbox);
} }
}); }
return queue; return queue;
} }

View file

@ -19,14 +19,14 @@ export async function publishToFollowers(userId: mongo.ObjectID) {
// フォロワーがリモートユーザーかつ投稿者がローカルユーザーならUpdateを配信 // フォロワーがリモートユーザーかつ投稿者がローカルユーザーならUpdateを配信
if (isLocalUser(user)) { if (isLocalUser(user)) {
followers.map(following => { for (const following of followers) {
const follower = following._follower; const follower = following._follower;
if (isRemoteUser(follower)) { if (isRemoteUser(follower)) {
const inbox = follower.sharedInbox || follower.inbox; const inbox = follower.sharedInbox || follower.inbox;
if (!queue.includes(inbox)) queue.push(inbox); if (!queue.includes(inbox)) queue.push(inbox);
} }
}); }
if (queue.length > 0) { if (queue.length > 0) {
const content = packAp(renderUpdate(await renderPerson(user), user)); const content = packAp(renderUpdate(await renderPerson(user), user));

View file

@ -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) { if (data.files) {
@ -562,7 +562,7 @@ async function publishToFollowers(note: INote, user: IUser, noteActivity: any) {
const queue: string[] = []; const queue: string[] = [];
followers.map(following => { for (const following of followers) {
const follower = following._follower; const follower = following._follower;
if (isLocalUser(follower)) { if (isLocalUser(follower)) {
@ -586,7 +586,7 @@ async function publishToFollowers(note: INote, user: IUser, noteActivity: any) {
if (!queue.includes(inbox)) queue.push(inbox); if (!queue.includes(inbox)) queue.push(inbox);
} }
} }
}); }
queue.forEach(inbox => { queue.forEach(inbox => {
deliver(user as any, noteActivity, inbox); deliver(user as any, noteActivity, inbox);