フォローインポートで自分をスキップするように (#4614)

* skip myself in import-following

* skip owner in publishToFollowers
This commit is contained in:
MeiMei 2019-04-06 00:07:23 +09:00 committed by syuilo
parent deaadc33db
commit 59dc929431
2 changed files with 5 additions and 1 deletions

View File

@ -45,6 +45,9 @@ export async function importFollowing(job: Bull.Job, done: any): Promise<void> {
target = await resolveUser(username, host);
}
// skip myself
if (target._id.equals(job.data.user._id)) continue;
logger.info(`Follow ${target._id} ...`);
follow(user, target);

View File

@ -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[] = [];