From 2db0e71e5bdc10f0654f3a4874d7f65717a92e71 Mon Sep 17 00:00:00 2001 From: dolfies Date: Fri, 7 Jul 2023 20:37:32 -0400 Subject: fix(RelationshipNotifier): Ignore user-actioned friend requests (#1390) --- src/plugins/relationshipNotifier/functions.ts | 2 +- src/plugins/relationshipNotifier/types.ts | 4 +++- src/plugins/relationshipNotifier/utils.ts | 7 +++++-- 3 files changed, 9 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/plugins/relationshipNotifier/functions.ts b/src/plugins/relationshipNotifier/functions.ts index 104436a..e712382 100644 --- a/src/plugins/relationshipNotifier/functions.ts +++ b/src/plugins/relationshipNotifier/functions.ts @@ -50,7 +50,7 @@ export async function onRelationshipRemove({ relationship: { type, id } }: Relat () => openUserProfile(user.id) ); break; - case RelationshipType.FRIEND_REQUEST: + case RelationshipType.INCOMING_REQUEST: if (settings.store.friendRequestCancels) notify( `A friend request from ${getUniqueUsername(user)} has been removed.`, diff --git a/src/plugins/relationshipNotifier/types.ts b/src/plugins/relationshipNotifier/types.ts index d49413a..c60d539 100644 --- a/src/plugins/relationshipNotifier/types.ts +++ b/src/plugins/relationshipNotifier/types.ts @@ -58,5 +58,7 @@ export const enum ChannelType { export const enum RelationshipType { FRIEND = 1, - FRIEND_REQUEST = 3, + BLOCKED = 2, + INCOMING_REQUEST = 3, + OUTGOING_REQUEST = 4, } diff --git a/src/plugins/relationshipNotifier/utils.ts b/src/plugins/relationshipNotifier/utils.ts index d5fd1da..5de9d75 100644 --- a/src/plugins/relationshipNotifier/utils.ts +++ b/src/plugins/relationshipNotifier/utils.ts @@ -80,7 +80,10 @@ export async function syncAndRunChecks() { if (settings.store.friendRequestCancels && oldFriends?.requests?.length) { for (const id of oldFriends.requests) { - if (friends.requests.includes(id)) continue; + if ( + friends.requests.includes(id) || + [RelationshipType.FRIEND, RelationshipType.BLOCKED, RelationshipType.OUTGOING_REQUEST].includes(RelationshipStore.getRelationshipType(id)) + ) continue; const user = await UserUtils.fetchUser(id).catch(() => void 0); if (user) @@ -164,7 +167,7 @@ export async function syncFriends() { case RelationshipType.FRIEND: friends.friends.push(id); break; - case RelationshipType.FRIEND_REQUEST: + case RelationshipType.INCOMING_REQUEST: friends.requests.push(id); break; } -- cgit