Co-authored-by: MeiMei <30769358+mei23@users.noreply.github.com>
Co-authored-by: Satsuki Yanagi <17376330+u1-liquid@users.noreply.github.com>
This commit is contained in:
syuilo 2020-01-30 04:37:25 +09:00 committed by GitHub
parent a5955c1123
commit f6154dc0af
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
871 changed files with 26140 additions and 71950 deletions

View file

@ -45,11 +45,21 @@ export async function insertFollowingDoc(followee: User, follower: User) {
}
});
await FollowRequests.delete({
const req = await FollowRequests.findOne({
followeeId: followee.id,
followerId: follower.id
});
if (req) {
await FollowRequests.delete({
followeeId: followee.id,
followerId: follower.id
});
// 通知を作成
createNotification(follower.id, followee.id, 'followRequestAccepted');
}
if (alreadyFollowed) return;
//#region Increment counts

View file

@ -25,7 +25,7 @@ export default async function(follower: User, followee: User, requestId?: string
if (blocking != null) throw new Error('blocking');
if (blocked != null) throw new Error('blocked');
await FollowRequests.save({
const followRequest = await FollowRequests.save({
id: genId(),
createdAt: new Date(),
followerId: follower.id,
@ -50,7 +50,9 @@ export default async function(follower: User, followee: User, requestId?: string
}).then(packed => publishMainStream(followee.id, 'meUpdated', packed));
// 通知を作成
createNotification(followee.id, follower.id, 'receiveFollowRequest');
createNotification(followee.id, follower.id, 'receiveFollowRequest', {
followRequestId: followRequest.id
});
}
if (Users.isLocalUser(follower) && Users.isRemoteUser(followee)) {