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

221 lines
13 KiB
TypeScript

// Metro module 5681 (f5682).
import GatedChannelStore from "../channel/GatedChannelStore";
import GuildOnboardingStore from "../guild_onboarding/GuildOnboardingStore";
import ChannelStore from "../../stores/ChannelStore";
import GuildRoleStore from "../../stores/GuildRoleStore";
import GuildStore from "../../stores/GuildStore";
import { GuildFeatures, ME } from "../../Constants";
import { StaticChannelRoute, isStaticChannelRoute } from "../channel/ChannelConstants";
import { canManageVibegrations } from "../vibegrations/lib/VibegrationsUtils";
import { areRoleSubscriptionsVisibleInGuild } from "../guild_role_subscriptions/useRoleSubscriptionsVisibleInGuild";
import { canUserSeeMonetizationOnboarding } from "../guild_settings/creator_monetization/canUserSeeMonetizationOnboarding";
import * as _SlayerStorefrontUtils from "../slayer_storefront/SlayerStorefrontUtils";
import * as _useGuildShopVisibleInGuild from "../creator_monetization/guild_shop/useGuildShopVisibleInGuild";
import { canReviewGuildMemberApplications } from "../guild_member_verification/canReviewGuildMemberApplications";
import * as _OnboardingHomeUtils from "../guild_onboarding_home/OnboardingHomeUtils";
import * as _MemberSafetyPermissionsUtils from "../guild_mod_dash_member_safety/MemberSafetyPermissionsUtils";
import getGuildModeratorReportingEnabled from "../report_to_mod/getGuildModeratorReportingEnabled";
import { getGameServerEnabled } from "../premium/game_server/GameServerExperiment";
import * as _GuildOfficialMessageUtils from "../messages/GuildOfficialMessageUtils";
import { canUseGuildSpace } from "../guild_space/canUseGuildSpace";
import { assertNever } from "../../utils/GlobalUtils";
import LazyLoadedThreadManager from "../threads/LazyLoadedThreadManager";
import ChannelActionCreators from "../../actions/ChannelActionCreators";
import { canViewChannel } from "./LinkUtils";
export default async function isAccessibleChannelOrThreadPath(c25535_0) {
let r79, r87, r100, r107, r164, r180, r203, r216, canAccessMemberSafetyPage, canReviewGuildMemberApplications2, canSeeOnboardingHome, canUseGuildSpace2, hasSocialLayerStorefront, isGuildOfficialMessagesEnabled, isGuildShopVisibleInGuild, shouldShowOnboarding;
let c25535_1, c25535_3;
let c29550_0, c29550_1, c29550_2, c29550_3, c29550_4;
L97: {
L96: {
L81: {
L78: {
L77: {
L74: {
L71: {
L70: {
L69: {
L68: {
L65: {
L64: {
L61: {
L60: {
L59: {
L56: {
L51: {
L50: {
L13: {
c25535_3 = void 0;
c29550_0 = void 0;
c29550_1 = void 0;
c29550_0 = c25535_0.guildId;
c29550_1 = c25535_0.channelId;
c29550_2 = void 0;
c29550_3 = void 0;
c29550_4 = void 0;
await void 0;
c29550_2 = GuildStore.getGuild(c29550_0);
c29550_3 = GuildRoleStore.getUnsafeMutableRoles(c29550_0);
if (c29550_2 == null) {
if (c29550_0 !== ME && c29550_1 !== StaticChannelRoute.GAME_SHOP) {
break L13;
}
}
if (c29550_1 == null) {
break L97;
}
if ((0, isStaticChannelRoute)(c29550_1)) {
const r82 = c29550_1;
if (StaticChannelRoute.VIBEGRATIONS === r82) {
r87 = c29550_2 != null;
if (!r87) {
break L81;
}
r87 = canManageVibegrations(c29550_2, "isAccessibleChannelOrThreadPath");
break L81;
}
if (StaticChannelRoute.ROLE_SUBSCRIPTIONS === r82) {
r100 = areRoleSubscriptionsVisibleInGuild(c29550_0, c29550_3);
break L78;
}
if (StaticChannelRoute.SERVER_MONETIZATION_ONBOARDING === r82) {
r107 = c29550_2 != null;
if (!r107) {
break L77;
}
r107 = canUserSeeMonetizationOnboarding(c29550_2);
break L77;
}
if (StaticChannelRoute.GAME_SHOP === r82) {
const r118 = c29550_2;
c25535_1 = r118;
if (r118 == null) {
c25535_1 = {
id: c29550_0,
type: "id-only"
};
}
hasSocialLayerStorefront = _SlayerStorefrontUtils.hasSocialLayerStorefront(c25535_1);
break L74;
}
if (StaticChannelRoute.GUILD_SHOP === r82) {
isGuildShopVisibleInGuild = _useGuildShopVisibleInGuild.isGuildShopVisibleInGuild(c29550_2, c29550_3);
break L71;
}
if (StaticChannelRoute.MEMBER_APPLICATIONS === r82) {
canReviewGuildMemberApplications2 = canReviewGuildMemberApplications(c29550_0);
break L70;
}
if (StaticChannelRoute.GUILD_HOME === r82) {
canSeeOnboardingHome = _OnboardingHomeUtils.canSeeOnboardingHome(c29550_0);
break L69;
}
if (StaticChannelRoute.CHANNEL_BROWSER === r82) {
r164 = c29550_2 != null;
if (!r164) {
break L68;
}
r164 = c29550_2.features.has(GuildFeatures.COMMUNITY);
break L68;
}
if (StaticChannelRoute.GUILD_ONBOARDING === r82) {
shouldShowOnboarding = GuildOnboardingStore.shouldShowOnboarding(c29550_0);
break L65;
}
if (StaticChannelRoute.CUSTOMIZE_COMMUNITY === r82) {
r180 = c29550_2 != null;
if (!r180) {
break L64;
}
r180 = c29550_2.features.has(GuildFeatures.COMMUNITY);
break L64;
}
if (StaticChannelRoute.MEMBER_SAFETY === r82) {
canAccessMemberSafetyPage = _MemberSafetyPermissionsUtils.canAccessMemberSafetyPage(c29550_0);
break L61;
}
if (StaticChannelRoute.GUILD_BOOSTS === r82) {
break L60;
}
if (StaticChannelRoute.REPORT_TO_MOD === r82) {
r203 = c29550_2 != null;
if (!r203) {
break L59;
}
r203 = getGuildModeratorReportingEnabled(c29550_2);
break L59;
}
if (StaticChannelRoute.GAME_SERVERS === r82) {
r216 = getGameServerEnabled(c29550_0, "isAccessibleChannelOrThreadPath") && c29550_2 != null;
if (!r216) {
break L56;
}
r216 = c29550_2.features.has(GuildFeatures.GAME_SERVERS);
break L56;
}
if (StaticChannelRoute.GUILD_OFFICIAL_MESSAGES === r82) {
isGuildOfficialMessagesEnabled = _GuildOfficialMessageUtils.isGuildOfficialMessagesEnabled(c29550_2, "isAccessibleChannelOrThreadPath");
break L51;
}
if (StaticChannelRoute.GUILD_SPACE === r82) {
canUseGuildSpace2 = canUseGuildSpace(c29550_2, "isAccessibleChannelOrThreadPath");
break L50;
}
assertNever(c29550_1);
}
c29550_4 = ChannelStore.getChannel(c29550_1);
r79 = c29550_4 != null;
if (!r79) {
await LazyLoadedThreadManager.loadThread(c29550_1);
const channel = ChannelStore.getChannel(c29550_1);
c29550_4 = channel;
if (channel == null && c29550_0 === ME) {
c29550_4 = await ChannelActionCreators.openChannel(c29550_1);
}
r79 = c29550_4 != null;
}
if (!r79) {
break L96;
}
r79 = canViewChannel(c29550_4) || GatedChannelStore.isChannelGatedAndVisible(c29550_0, c29550_1);
break L96;
}
return false;
}
return canUseGuildSpace2;
}
return isGuildOfficialMessagesEnabled;
}
return r216;
}
return r203;
}
return true;
}
return canAccessMemberSafetyPage;
}
return r180;
}
return shouldShowOnboarding;
}
return r164;
}
return canSeeOnboardingHome;
}
return canReviewGuildMemberApplications2;
}
return isGuildShopVisibleInGuild;
}
return hasSocialLayerStorefront;
}
return r107;
}
return r100;
}
return r87;
}
return r79;
}
return true;
};