Files
discord-decomp/modules/routing/getChannelIdForGuildTransition.tsx
T
2026-11-01 12:12:55 +02:00

42 lines
1.8 KiB
TypeScript

// Metro module 5653 (f5654).
import GuildOnboardingStore from "../guild_onboarding/GuildOnboardingStore";
import ChannelStore from "../../stores/ChannelStore";
import GuildChannelStore from "../../stores/GuildChannelStore";
import GuildStore from "../../stores/GuildStore";
import SelectedChannelStore from "../../stores/SelectedChannelStore";
import PrivateChannelSortStore from "../../stores/views/PrivateChannelSortStore";
import { ME } from "../../Constants";
import { StaticChannelRoute } from "../channel/ChannelConstants";
import { canSeeOnboardingHome } from "../guild_onboarding_home/OnboardingHomeUtils";
import { canUseGuildSpace } from "../guild_space/canUseGuildSpace";
import { canSeeGameShop } from "../slayer_storefront/SlayerStorefrontUtils";
export function getChannelIdForGuildTransition(a0) {
const channelId = SelectedChannelStore.getChannelId(a0);
let r14 = GuildChannelStore.getDefaultChannel(a0)?.id;
if (r14 == null) {
let r15 = void 0;
if (a0 === ME) {
const privateChannelIds = PrivateChannelSortStore.getPrivateChannelIds();
r15 = privateChannelIds.length > 0 ? privateChannelIds[0] : void 0;
}
r14 = r15;
}
if (channelId === StaticChannelRoute.GUILD_ONBOARDING && !GuildOnboardingStore.shouldShowOnboarding(a0)) {
return r14;
}
if (channelId === StaticChannelRoute.GUILD_HOME && !canSeeOnboardingHome(a0)) {
return r14;
}
if (channelId === StaticChannelRoute.GUILD_SPACE) {
if (canUseGuildSpace(GuildStore.getGuild(a0), "getChannelIdForGuildTransition")) {
r14 = channelId;
}
return r14;
}
if (channelId === StaticChannelRoute.GAME_SHOP && canSeeGameShop(a0)) {
return channelId;
}
const channel = ChannelStore.getChannel(channelId);
return channel != null ? channel.isGuildVocal() ? r14 : channelId : r14;
}