RelationshipNotifier: Fix false positives when using AccountSwitcher
This commit is contained in:
parent
9f534c0685
commit
4dce836ff7
@ -18,7 +18,7 @@
|
|||||||
|
|
||||||
import { DataStore, Notices } from "@api/index";
|
import { DataStore, Notices } from "@api/index";
|
||||||
import { showNotification } from "@api/Notifications";
|
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 settings from "./settings";
|
||||||
import { ChannelType, RelationshipType, SimpleGroupChannel, SimpleGuild } from "./types";
|
import { ChannelType, RelationshipType, SimpleGroupChannel, SimpleGuild } from "./types";
|
||||||
@ -106,7 +106,11 @@ export function deleteGuild(id: string) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export async function syncGuilds() {
|
export async function syncGuilds() {
|
||||||
|
guilds.clear();
|
||||||
|
|
||||||
|
const me = UserStore.getCurrentUser().id;
|
||||||
for (const [id, { name, icon }] of Object.entries(GuildStore.getGuilds())) {
|
for (const [id, { name, icon }] of Object.entries(GuildStore.getGuilds())) {
|
||||||
|
if (GuildMemberStore.isMember(id, me))
|
||||||
guilds.set(id, {
|
guilds.set(id, {
|
||||||
id,
|
id,
|
||||||
name,
|
name,
|
||||||
@ -126,6 +130,8 @@ export function deleteGroup(id: string) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export async function syncGroups() {
|
export async function syncGroups() {
|
||||||
|
groups.clear();
|
||||||
|
|
||||||
for (const { type, id, name, rawRecipients, icon } of ChannelStore.getSortedPrivateChannels()) {
|
for (const { type, id, name, rawRecipients, icon } of ChannelStore.getSortedPrivateChannels()) {
|
||||||
if (type === ChannelType.GROUP_DM)
|
if (type === ChannelType.GROUP_DM)
|
||||||
groups.set(id, {
|
groups.set(id, {
|
||||||
|
Loading…
Reference in New Issue
Block a user