mirror of
https://github.com/Vendicated/Vencord.git
synced 2024-09-20 14:40:34 +00:00
fix: regression where RelationshipNotifier errors when CHANNEL_DELETE
is dispatched with a partial ChannelRecord
This commit is contained in:
parent
91aa450ee3
commit
296375a23e
2 changed files with 11 additions and 3 deletions
|
@ -18,7 +18,7 @@
|
|||
|
||||
import { getUniqueUsername, openUserProfile } from "@utils/discord";
|
||||
import { RelationshipType } from "@vencord/discord-types";
|
||||
import { UserActionCreators } from "@webpack/common";
|
||||
import { ChannelStore, UserActionCreators } from "@webpack/common";
|
||||
|
||||
import settings from "./settings";
|
||||
import type { ChannelDeleteAction, GuildDeleteAction, RelationshipRemoveAction } from "./types";
|
||||
|
@ -80,7 +80,10 @@ export function onGuildDelete({ guild: { id, unavailable } }: GuildDeleteAction)
|
|||
|
||||
export function onChannelDelete({ channel, channel: { id } }: ChannelDeleteAction) {
|
||||
if (!settings.store.groups) return;
|
||||
if (!channel.isGroupDM()) return;
|
||||
if ("isGroupDM" in channel) {
|
||||
if (!channel.isGroupDM()) return;
|
||||
} else
|
||||
if (!ChannelStore.getChannel(id)?.isGroupDM()) return;
|
||||
|
||||
if (manuallyRemovedGroupDM === id) {
|
||||
deleteGroupDM(id);
|
||||
|
|
|
@ -20,7 +20,12 @@ import type { ChannelRecord } from "@vencord/discord-types";
|
|||
|
||||
export interface ChannelDeleteAction {
|
||||
type: "CHANNEL_DELETE";
|
||||
channel: ChannelRecord;
|
||||
channel: ChannelRecord | {
|
||||
guild_id: string | undefined;
|
||||
id: string;
|
||||
parent_id: string | undefined;
|
||||
};
|
||||
silent?: boolean;
|
||||
}
|
||||
|
||||
export interface GuildDeleteAction {
|
||||
|
|
Loading…
Reference in a new issue