47 lines
1.8 KiB
TypeScript
47 lines
1.8 KiB
TypeScript
// Metro module 5789 (f5790).
|
|
import GuildStore from "../../stores/GuildStore";
|
|
import PermissionStore from "../../stores/PermissionStore";
|
|
import UserGuildSettingsStore from "../../stores/UserGuildSettingsStore";
|
|
import UserStore from "../../stores/UserStore";
|
|
import { GuildFeatures, Permissions } from "../../Constants";
|
|
import { useStateFromStores } from "../../_bundle/Module589";
|
|
export function useOptInEnabledForGuild(c15171_0) {
|
|
return useStateFromStores([UserGuildSettingsStore, GuildStore, UserStore], () => {
|
|
let r9 = UserGuildSettingsStore.isOptInEnabled(c15171_0);
|
|
const guild = GuildStore.getGuild(c15171_0);
|
|
let r13 = guild == null ? void 0 : guild.features.has(GuildFeatures.COMMUNITY);
|
|
if (r13 == null) {
|
|
r13 = false;
|
|
}
|
|
const currentUser = UserStore.getCurrentUser();
|
|
let r20 = currentUser == null ? void 0 : currentUser.isStaff();
|
|
if (r20 == null) {
|
|
r20 = false;
|
|
}
|
|
if (r9) {
|
|
if (!r13) {
|
|
r13 = r20;
|
|
}
|
|
r9 = r13;
|
|
}
|
|
return r9;
|
|
});
|
|
}
|
|
export function isOptInEnabledForGuild(a0) {
|
|
const guild = GuildStore.getGuild(a0);
|
|
const currentUser = UserStore.getCurrentUser();
|
|
return a0 != null && guild != null && currentUser != null && ((guild.features.has(GuildFeatures.COMMUNITY) || currentUser.isStaff()) && UserGuildSettingsStore.isOptInEnabled(a0));
|
|
}
|
|
export function useShouldShowOnboardingAdminUpsellForGuild(c15172_0) {
|
|
return useStateFromStores([GuildStore, PermissionStore], () => {
|
|
const guild = GuildStore.getGuild(c15172_0);
|
|
const r13 = PermissionStore.can(Permissions.MANAGE_GUILD, guild);
|
|
const r16 = PermissionStore.can(Permissions.MANAGE_ROLES, guild);
|
|
let r17 = guild == null ? void 0 : guild.features.has(GuildFeatures.GUILD_ONBOARDING_EVER_ENABLED);
|
|
if (r17 == null) {
|
|
r17 = false;
|
|
}
|
|
return guild != null && r13 && r16 && !r17;
|
|
});
|
|
}
|