Skipped 1 file(s) >100MB (GitHub limit): source/__polyfill/04xxx/module_4792.js (118.4 MB)
83 lines
2.9 KiB
TypeScript
83 lines
2.9 KiB
TypeScript
// Module ID: 7609
|
|
// Function ID: 7610
|
|
// Name: isOptInEnabled
|
|
// Dependencies: [1979, 4245, 4788, 1371, 1074, 504, 2]
|
|
// Exports: isOptInEnabledForGuild, useOptInEnabledForGuild, useShouldShowOnboardingAdminUpsellForGuild
|
|
|
|
// Module 7609 (isOptInEnabled)
|
|
import GuildStore from "GuildStore" /* 1979 */;
|
|
import PermissionStore from "PermissionStore" /* 4245 */;
|
|
import UserGuildSettingsStore from "UserGuildSettingsStore" /* 4788 */;
|
|
import UserStore from "UserStore" /* 1371 */;
|
|
|
|
const require = globalThis.__r;
|
|
|
|
const require = fn;
|
|
const Constants = fn(1074);
|
|
({ GuildFeatures: metroRequire, Permissions: closure_7 } = Constants);
|
|
const size = fn(2);
|
|
const result = size.fileFinishedImporting("modules/opt_in_channels/isOptInEnabled.tsx");
|
|
|
|
export const useOptInEnabledForGuild = function useOptInEnabledForGuild(id) {
|
|
_require = id;
|
|
const items = [UserGuildSettingsStore, GuildStore, UserStore];
|
|
return require("initialize").useStateFromStores(items, () => {
|
|
let isOptInEnabledResult = UserGuildSettingsStore.isOptInEnabled(closure_0);
|
|
const guild = GuildStore.getGuild(closure_0);
|
|
let flag;
|
|
if (guild != null) {
|
|
const features = guild.features;
|
|
flag = features.has(constants.COMMUNITY);
|
|
}
|
|
if (flag == null) {
|
|
flag = false;
|
|
}
|
|
const currentUser = UserStore.getCurrentUser();
|
|
let flag2;
|
|
if (currentUser != null) {
|
|
flag2 = currentUser.isStaff();
|
|
}
|
|
if (flag2 == null) {
|
|
flag2 = false;
|
|
}
|
|
if (isOptInEnabledResult) {
|
|
if (!flag) {
|
|
flag = flag2;
|
|
}
|
|
isOptInEnabledResult = flag;
|
|
}
|
|
return isOptInEnabledResult;
|
|
});
|
|
};
|
|
export const isOptInEnabledForGuild = function isOptInEnabledForGuild(_guildId) {
|
|
const guild = GuildStore.getGuild(_guildId);
|
|
const currentUser = UserStore.getCurrentUser();
|
|
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 = UserGuildSettingsStore.isOptInEnabled(_guildId);
|
|
}
|
|
tmp2 = isOptInEnabledResult;
|
|
}
|
|
return tmp2;
|
|
};
|
|
export const useShouldShowOnboardingAdminUpsellForGuild = function useShouldShowOnboardingAdminUpsellForGuild(arg0) {
|
|
_require = arg0;
|
|
const items = [GuildStore, PermissionStore];
|
|
return require("initialize").useStateFromStores(items, () => {
|
|
const guild = GuildStore.getGuild(closure_0);
|
|
let flag;
|
|
const canResult = PermissionStore.can(constants2.MANAGE_GUILD, guild);
|
|
if (guild != null) {
|
|
const features = guild.features;
|
|
flag = features.has(constants.GUILD_ONBOARDING_EVER_ENABLED);
|
|
}
|
|
if (flag == null) {
|
|
flag = false;
|
|
}
|
|
const canResult1 = PermissionStore.can(constants2.MANAGE_ROLES, guild);
|
|
return null != guild && canResult && PermissionStore.can(constants2.MANAGE_ROLES, guild) && !flag;
|
|
});
|
|
};
|