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

41 lines
1.5 KiB
TypeScript

// Metro module 4631 (f4632).
import GatedChannelStore from "../channel/GatedChannelStore";
import ChannelStore from "../../stores/ChannelStore";
import PermissionStore from "../../stores/PermissionStore";
import { Permissions } from "../../Constants";
import { useStateFromStoresObject } from "../../_bundle/Module589";
let c2826_6;
const getChannelRoleSubscriptionStatus = function getChannelRoleSubscriptionStatus(id, r7 = ChannelStore, r8 = GatedChannelStore, r6 = PermissionStore) {
let r16;
const channel = r7.getChannel(id);
const r10 = channel == null ? void 0 : channel.isRoleSubscriptionTemplatePreviewChannel();
L18: {
if (r10) {
r16 = {
isSubscriptionGated: true,
needSubscriptionToAccess: true
};
} else {
if (channel != null && r8.isChannelGated(channel.guild_id, channel.id)) {
const isGuildVocal = channel.isGuildVocal();
const can = r6.can;
r16 = {
isSubscriptionGated: true,
needSubscriptionToAccess: isGuildVocal ? !can.call(r6, Permissions.CONNECT, channel) : !can.call(r6, Permissions.VIEW_CHANNEL, channel)
};
break L18;
}
r16 = c2826_6;
}
}
return r16;
};
c2826_6 = {
needSubscriptionToAccess: false,
isSubscriptionGated: false
};
export default function useChannelRoleSubscriptionStatus(a0) {
return useStateFromStoresObject([ChannelStore, GatedChannelStore, PermissionStore], () => getChannelRoleSubscriptionStatus(a0, ChannelStore, GatedChannelStore, PermissionStore), [a0]);
};
export { getChannelRoleSubscriptionStatus };