diff options
author | Vendicated <vendicated@riseup.net> | 2023-05-02 02:15:22 +0200 |
---|---|---|
committer | Vendicated <vendicated@riseup.net> | 2023-05-02 02:52:09 +0200 |
commit | 4dce836ff73f22ef5ead1dd4803d4516f0ebd1e8 (patch) | |
tree | 94e06d400ac8054b84272a9a1e7fe5e78957555c /src | |
parent | 9f534c068549ee720e75d808162e208dac17fd10 (diff) | |
download | Vencord-4dce836ff73f22ef5ead1dd4803d4516f0ebd1e8.tar.gz Vencord-4dce836ff73f22ef5ead1dd4803d4516f0ebd1e8.tar.bz2 Vencord-4dce836ff73f22ef5ead1dd4803d4516f0ebd1e8.zip |
RelationshipNotifier: Fix false positives when using AccountSwitcher
Diffstat (limited to 'src')
-rw-r--r-- | src/plugins/relationshipNotifier/utils.ts | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/src/plugins/relationshipNotifier/utils.ts b/src/plugins/relationshipNotifier/utils.ts index 39b7fce..60fb0c6 100644 --- a/src/plugins/relationshipNotifier/utils.ts +++ b/src/plugins/relationshipNotifier/utils.ts @@ -18,7 +18,7 @@ import { DataStore, Notices } from "@api/index"; import { showNotification } from "@api/Notifications"; -import { ChannelStore, GuildStore, RelationshipStore, UserStore, UserUtils } from "@webpack/common"; +import { ChannelStore, GuildMemberStore, GuildStore, RelationshipStore, UserStore, UserUtils } from "@webpack/common"; import settings from "./settings"; import { ChannelType, RelationshipType, SimpleGroupChannel, SimpleGuild } from "./types"; @@ -106,12 +106,16 @@ export function deleteGuild(id: string) { } export async function syncGuilds() { + guilds.clear(); + + const me = UserStore.getCurrentUser().id; for (const [id, { name, icon }] of Object.entries(GuildStore.getGuilds())) { - guilds.set(id, { - id, - name, - iconURL: icon && `https://cdn.discordapp.com/icons/${id}/${icon}.png` - }); + if (GuildMemberStore.isMember(id, me)) + guilds.set(id, { + id, + name, + iconURL: icon && `https://cdn.discordapp.com/icons/${id}/${icon}.png` + }); } await DataStore.set(guildsKey(), guilds); } @@ -126,6 +130,8 @@ export function deleteGroup(id: string) { } export async function syncGroups() { + groups.clear(); + for (const { type, id, name, rawRecipients, icon } of ChannelStore.getSortedPrivateChannels()) { if (type === ChannelType.GROUP_DM) groups.set(id, { |