From 43864f0da427285cecb502328be819f2e6eb5883 Mon Sep 17 00:00:00 2001 From: syuilo Date: Fri, 15 Feb 2019 05:56:28 +0900 Subject: 既にフォローされている場合はフォローリクエストを生成しないように (#4266) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/services/following/create.ts | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'src/services') diff --git a/src/services/following/create.ts b/src/services/following/create.ts index a050f40b0e..5a92e4103a 100644 --- a/src/services/following/create.ts +++ b/src/services/following/create.ts @@ -153,8 +153,17 @@ export default async function(follower: IUser, followee: IUser, requestId?: stri if (followee.isLocked || (followee.carefulBot && follower.isBot) || (isLocalUser(follower) && isRemoteUser(followee))) { let autoAccept = false; + // 鍵アカウントであっても、既にフォローされていた場合はスルー + const following = await Following.findOne({ + followerId: follower._id, + followeeId: followee._id, + }); + if (following) { + autoAccept = true; + } + // フォローしているユーザーは自動承認オプション - if (isLocalUser(followee) && followee.autoAcceptFollowed) { + if (!autoAccept && (isLocalUser(followee) && followee.autoAcceptFollowed)) { const followed = await Following.findOne({ followerId: followee._id, followeeId: follower._id -- cgit v1.2.3-freya