From 59dc9294313f2654b518d6fb05ed3d53ff056ce9 Mon Sep 17 00:00:00 2001 From: MeiMei <30769358+mei23@users.noreply.github.com> Date: Sat, 6 Apr 2019 00:07:23 +0900 Subject: [PATCH] =?UTF-8?q?=E3=83=95=E3=82=A9=E3=83=AD=E3=83=BC=E3=82=A4?= =?UTF-8?q?=E3=83=B3=E3=83=9D=E3=83=BC=E3=83=88=E3=81=A7=E8=87=AA=E5=88=86?= =?UTF-8?q?=E3=82=92=E3=82=B9=E3=82=AD=E3=83=83=E3=83=97=E3=81=99=E3=82=8B?= =?UTF-8?q?=E3=82=88=E3=81=86=E3=81=AB=20(#4614)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * skip myself in import-following * skip owner in publishToFollowers --- src/queue/processors/db/import-following.ts | 3 +++ src/services/note/create.ts | 3 ++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/queue/processors/db/import-following.ts b/src/queue/processors/db/import-following.ts index ad9129c1f..a1242b71c 100644 --- a/src/queue/processors/db/import-following.ts +++ b/src/queue/processors/db/import-following.ts @@ -45,6 +45,9 @@ export async function importFollowing(job: Bull.Job, done: any): Promise { target = await resolveUser(username, host); } + // skip myself + if (target._id.equals(job.data.user._id)) continue; + logger.info(`Follow ${target._id} ...`); follow(user, target); diff --git a/src/services/note/create.ts b/src/services/note/create.ts index 5f69329a4..85201086d 100644 --- a/src/services/note/create.ts +++ b/src/services/note/create.ts @@ -568,7 +568,8 @@ async function publishToFollowers(note: INote, user: IUser, noteActivity: any) { }); const followers = await Following.find({ - followeeId: note.userId + followeeId: note.userId, + followerId: { $ne: note.userId } // バグでフォロワーに自分がいることがあるため }); const queue: string[] = [];