decord/source/modules/opt_in_channels/isOptInEnabled.tsx

81 lines
2.8 KiB
TypeScript
Raw Normal View History

2026-08-24 06:08:38 +00:00
// Module ID: 5287
// Function ID: 5288
2026-07-20 16:05:17 +00:00
// Name: useOptInEnabledForGuild
2026-08-24 06:08:38 +00:00
// Dependencies: [1910, 4024, 5048, 1922, 676, 589, 2]
2026-07-20 16:05:17 +00:00
// Exports: isOptInEnabledForGuild, useOptInEnabledForGuild, useShouldShowOnboardingAdminUpsellForGuild
2026-08-24 06:08:38 +00:00
// Module 5287 (useOptInEnabledForGuild)
import closure_2 from "createGuildRecordFromRust" /* 1910 */;
import closure_3 from "getUncachedChannelPermissions" /* 4024 */;
import closure_4 from "updateUserGuildSettingsInternal" /* 5048 */;
import closure_5 from "mergeGuildAvatar" /* 1922 */;
import ME from "ME" /* 676 */;
2026-07-23 10:11:24 +00:00
const require = arg1;
2026-07-29 08:29:29 +00:00
({ GuildFeatures: closure_6, Permissions: error } = ME);
2026-08-24 06:08:38 +00:00
const result = require("set").fileFinishedImporting("modules/opt_in_channels/isOptInEnabled.tsx");
2026-07-20 16:05:17 +00:00
2026-08-03 11:20:01 +00:00
export const useOptInEnabledForGuild = function useOptInEnabledForGuild(id) {
const _require = id;
2026-08-24 06:08:38 +00:00
const items = [closure_4, closure_2, closure_5];
2026-07-29 08:29:29 +00:00
return _require(589).useStateFromStores(items, () => {
2026-08-24 06:08:38 +00:00
let isOptInEnabledResult = closure_1_4.isOptInEnabled(closure_0);
const guild = closure_1_2.getGuild(closure_0);
2026-07-29 08:29:29 +00:00
let flag;
if (guild != null) {
2026-07-20 16:05:17 +00:00
const features = guild.features;
2026-08-24 06:08:38 +00:00
flag = features.has(closure_1_6.COMMUNITY);
2026-07-29 08:29:29 +00:00
}
if (flag == null) {
flag = false;
2026-07-20 16:05:17 +00:00
}
2026-08-24 06:08:38 +00:00
const currentUser = closure_1_5.getCurrentUser();
2026-07-29 08:29:29 +00:00
let flag2;
if (currentUser != null) {
flag2 = currentUser.isStaff();
}
if (flag2 == null) {
flag2 = false;
2026-07-20 16:05:17 +00:00
}
if (isOptInEnabledResult) {
2026-07-29 08:29:29 +00:00
if (!flag) {
flag = flag2;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
isOptInEnabledResult = flag;
2026-07-20 16:05:17 +00:00
}
return isOptInEnabledResult;
});
};
export const isOptInEnabledForGuild = function isOptInEnabledForGuild(_guildId) {
2026-07-23 10:11:24 +00:00
guild = guild.getGuild(_guildId);
currentUser = currentUser.getCurrentUser();
2026-07-20 16:05:17 +00:00
let tmp2 = null != _guildId && null != guild && null != currentUser;
if (tmp2) {
const features = guild.features;
let isOptInEnabledResult = features.has(constants.COMMUNITY) || currentUser.isStaff();
if (isOptInEnabledResult) {
isOptInEnabledResult = optInEnabled.isOptInEnabled(_guildId);
}
tmp2 = isOptInEnabledResult;
}
return tmp2;
};
export const useShouldShowOnboardingAdminUpsellForGuild = function useShouldShowOnboardingAdminUpsellForGuild(arg0) {
2026-07-23 10:11:24 +00:00
const _require = arg0;
2026-08-24 06:08:38 +00:00
const items = [closure_2, closure_3];
2026-07-29 08:29:29 +00:00
return _require(589).useStateFromStores(items, () => {
2026-08-24 06:08:38 +00:00
const guild = closure_1_2.getGuild(closure_0);
2026-07-29 08:29:29 +00:00
let flag;
2026-08-24 06:08:38 +00:00
const canResult = closure_1_3.can(closure_1_7.MANAGE_GUILD, guild);
2026-07-29 08:29:29 +00:00
if (guild != null) {
2026-07-20 16:05:17 +00:00
const features = guild.features;
2026-08-24 06:08:38 +00:00
flag = features.has(closure_1_6.GUILD_ONBOARDING_EVER_ENABLED);
2026-07-29 08:29:29 +00:00
}
if (flag == null) {
flag = false;
2026-07-20 16:05:17 +00:00
}
2026-08-24 06:08:38 +00:00
const canResult1 = closure_1_3.can(closure_1_7.MANAGE_ROLES, guild);
return null != guild && canResult && closure_1_3.can(closure_1_7.MANAGE_ROLES, guild) && !flag;
2026-07-20 16:05:17 +00:00
});
};