ToastNotifications fix VoiceChan/Forum not jumping (#905)

* fix voicechan/forum

* fix toast channel navigation
This commit is contained in:
oma 2026-03-14 21:32:10 -04:00 • committed by GitHub
parent d513fbe7e7
commit 86e8b15718
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -34,6 +34,7 @@ let notifyFor: string[] = [];
// Functional variables. // Functional variables.
const MuteStore = findByPropsLazy("isSuppressEveryoneEnabled"); const MuteStore = findByPropsLazy("isSuppressEveryoneEnabled");
const SelectedChannelActionCreators = findByPropsLazy("selectPrivateChannel"); const SelectedChannelActionCreators = findByPropsLazy("selectPrivateChannel");
const ChannelRTCActions = findByPropsLazy("updateChatOpen", "toggleParticipants");
const UserUtils = findByPropsLazy("getGlobalName"); const UserUtils = findByPropsLazy("getGlobalName");
// Adjustable variables. // Adjustable variables.
@ -395,6 +396,16 @@ function switchChannels(guildId: string | null, channelId: string) {
NavigationRouter.transitionTo(`/channels/${guildId ?? "@me"}/${channelId}/`); NavigationRouter.transitionTo(`/channels/${guildId ?? "@me"}/${channelId}/`);
} }
function navigateToChannel(channel: Channel) {
if (channel.isGuildVocal?.()) {
switchChannels(channel.guild_id, channel.id);
ChannelRTCActions.updateChatOpen(channel.id, true);
return;
}
switchChannels(channel.guild_id, channel.id);
}
enum NotificationLevel { enum NotificationLevel {
ALL_MESSAGES = 0, ALL_MESSAGES = 0,
ONLY_MENTIONS = 1, ONLY_MENTIONS = 1,
@ -458,7 +469,7 @@ async function handleGuildMessage(message: Message) {
attachments: message.attachments?.length, attachments: message.attachments?.length,
richBody: null, richBody: null,
permanent: false, permanent: false,
onClick() { switchChannels(channel.guild_id, channel.id); } onClick() { navigateToChannel(channel); }
}; };
if (message.embeds?.length !== 0) { if (message.embeds?.length !== 0) {
@ -527,7 +538,6 @@ async function handleGuildMessage(message: Message) {
Notification.icon = undefined; Notification.icon = undefined;
} }
console.log("noti that went through: " + t);
await showNotification(Notification); await showNotification(Notification);
} }