54 lines
2.2 KiB
TypeScript
54 lines
2.2 KiB
TypeScript
// Metro module 9358 (f9359).
|
|
import GuildStore from "../../../stores/GuildStore";
|
|
import PermissionStore from "../../../stores/PermissionStore";
|
|
import UserStore from "../../../stores/UserStore";
|
|
import { GuildNSFWContentLevel, Permissions } from "../../../Constants";
|
|
import { isIOS } from "../../../utils/PlatformUtils";
|
|
import ModalActionCreators from "../../../actions/ModalActionCreators";
|
|
import { getViewNsfwGuildsOrDefault } from "../../user_settings/content_and_social/AgeRestrictedContentSettingsUtils";
|
|
let c6168_8 = new Set([GuildNSFWContentLevel.EXPLICIT, GuildNSFWContentLevel.AGE_RESTRICTED]);
|
|
export function isNSFWInvite(a0) {
|
|
let r3 = a0 == null ? void 0 : a0.guild?.nsfw_level;
|
|
if (r3 == null) {
|
|
r3 = GuildNSFWContentLevel.DEFAULT;
|
|
}
|
|
return c6168_8.has(r3);
|
|
}
|
|
export function handleNSFWGuildInvite(a0) {
|
|
if (isIOS()) {
|
|
let r17 = a0 == null ? void 0 : a0.guild?.nsfw_level;
|
|
if (r17 == null) {
|
|
r17 = GuildNSFWContentLevel.DEFAULT;
|
|
}
|
|
const r20 = c6168_8.has(r17);
|
|
const r27 = GuildStore.getGuild(a0 == null ? void 0 : a0.guild?.id) != null;
|
|
const r1 = r20 ? r27 : !r20;
|
|
let r28 = !r1;
|
|
if (!r1) {
|
|
ModalActionCreators.pushLazy(import("./components/NsfwGateGuild"), {
|
|
guildId: a0 == null ? void 0 : a0.guild?.id
|
|
});
|
|
r28 = true;
|
|
}
|
|
return r28;
|
|
}
|
|
return false;
|
|
}
|
|
export function shouldNSFWGateGuild(a0) {
|
|
if (isIOS()) {
|
|
const guild = GuildStore.getGuild(a0);
|
|
const currentUser = UserStore.getCurrentUser();
|
|
if (guild != null && currentUser != null) {
|
|
const r24 = PermissionStore.can(Permissions.ADMINISTRATOR, guild) || PermissionStore.can(Permissions.MANAGE_GUILD, guild) || PermissionStore.can(Permissions.KICK_MEMBERS, guild) || PermissionStore.can(Permissions.BAN_MEMBERS, guild);
|
|
const nsfwLevel = guild.nsfwLevel;
|
|
const AGE_RESTRICTED = GuildNSFWContentLevel.AGE_RESTRICTED;
|
|
const nsfwLevel2 = guild.nsfwLevel;
|
|
const EXPLICIT = GuildNSFWContentLevel.EXPLICIT;
|
|
const r35 = currentUser.nsfwAllowed && getViewNsfwGuildsOrDefault();
|
|
return r24 ? !r24 : !!(nsfwLevel2 === EXPLICIT) || nsfwLevel === AGE_RESTRICTED && !r35;
|
|
}
|
|
return false;
|
|
}
|
|
return false;
|
|
}
|