Skipped 1 file(s) >100MB (GitHub limit): source/__polyfill/04xxx/module_4790.js (118.4 MB)
573 lines
22 KiB
TypeScript
573 lines
22 KiB
TypeScript
// Module ID: 4816
|
|
// Function ID: 4817
|
|
// Name: AgeGateUtils
|
|
// Dependencies: [1975, 1957, 4817, 1979, 1371, 1098, 1074, 1114, 11, 4818, 5473, 5474, 504, 8478, 2024, 7263, 7381, 2]
|
|
// Exports: guildNeedsAgeGate, isChannelAgeVerificationGated, isChannelOrGuildNSFW, isCurrentUserMissingDateOfBirth, maybeOpenAgeGateForVoiceChannel, maybeShowAgeGate, shouldAgeVerifyForAgeGate, shouldAgeVerifyForSettingsToggles, shouldShowAgeGateForChannelId, shouldShowAgeGateForCurrentUser, shouldShowAgeGateForGuildContentLevel, useAgeGateVerifyContent, useAgeGateVerifyContentForGuild, useShouldAgeVerifyForAgeGate, useShouldAgeVerifyForSettingsToggles, useShouldHideChannelContent, userCannotSeeNSFWContent, userNeedsAgeGate
|
|
|
|
// Module 4816 (AgeGateUtils)
|
|
import SnowflakeUtilsDefault from "SnowflakeUtils" /* 11 */;
|
|
import initialize from "initialize" /* 504 */;
|
|
import AgeGateConstants from "AgeGateConstants" /* 1098 */;
|
|
import GuildRecord from "GuildRecord" /* 1975 */;
|
|
import HelpdeskUtilsDefault from "HelpdeskUtils" /* 2024 */;
|
|
import AgeVerificationUtils from "AgeVerificationUtils" /* 4818 */;
|
|
import RegionalFeatureConfigUtils from "RegionalFeatureConfigUtils" /* 5473 */;
|
|
import AgeGatedFeature from "AgeGatedFeature" /* 5474 */;
|
|
import AgeGateModalActionCreators from "AgeGateModalActionCreators" /* 7263 */;
|
|
import ChannelStore from "ChannelStore" /* 1957 */;
|
|
import GuildNSFWAgreeStore from "GuildNSFWAgreeStore" /* 4817 */;
|
|
import GuildStore from "GuildStore" /* 1979 */;
|
|
import UserStore from "UserStore" /* 1371 */;
|
|
import Constants from "Constants" /* 1074 */;
|
|
import size from "module_2" /* 2 */;
|
|
|
|
const require = globalThis.__r;
|
|
|
|
function shouldShowAgeGateForVoiceChannel(channelId) {
|
|
const result = AgeVerificationUtils.shouldShowTiggerPawtect();
|
|
let tmp4 = RegionalFeatureConfigUtils.isFeatureAgeGated(AgeGatedFeature.AgeGatedFeature.AGE_GATED_SPACES) && result;
|
|
if (tmp4) {
|
|
const currentUser = UserStore.getCurrentUser();
|
|
let flag = false;
|
|
if (null != currentUser) {
|
|
const result1 = tmp(4818).shouldShowTiggerPawtect();
|
|
const tmpResult = tmp(4818);
|
|
const tmpResult2 = tmp(5473);
|
|
const tmp9 = tmp(5473).isFeatureAgeGated(tmp(5474).AgeGatedFeature.AGE_GATED_SPACES) && result1;
|
|
flag = true !== currentUser.nsfwAllowed || tmp(5473).isFeatureAgeGated(tmp(5474).AgeGatedFeature.AGE_GATED_SPACES) && result1;
|
|
const tmp10 = true !== currentUser.nsfwAllowed || tmp(5473).isFeatureAgeGated(tmp(5474).AgeGatedFeature.AGE_GATED_SPACES) && result1;
|
|
}
|
|
let tmp12 = !flag;
|
|
if (flag) {
|
|
tmp12 = null == channelId;
|
|
}
|
|
let tmp13 = !tmp12;
|
|
if (!tmp12) {
|
|
tmp13 = isChannelContentGated(ChannelStore.getChannel(channelId));
|
|
}
|
|
tmp4 = tmp13;
|
|
}
|
|
return tmp4;
|
|
}
|
|
function isChannelContentGated(channel) {
|
|
if (null == channel) {
|
|
return false;
|
|
} else {
|
|
let didAgreeResult = GuildNSFWAgreeStore.didAgree(channel.guild_id);
|
|
const currentUser = UserStore.getCurrentUser();
|
|
if (currentUser != null) {
|
|
const nsfwAllowed = currentUser.nsfwAllowed;
|
|
}
|
|
const isFeatureAgeGatedResult = RegionalFeatureConfigUtils.isFeatureAgeGated(AgeGatedFeature.AgeGatedFeature.AGE_GATED_SPACES);
|
|
let result = AgeVerificationUtils.shouldShowTiggerPawtect();
|
|
if (didAgreeResult) {
|
|
didAgreeResult = false !== nsfwAllowed;
|
|
}
|
|
let tmp6 = !didAgreeResult;
|
|
if (didAgreeResult) {
|
|
if (result) {
|
|
result = isFeatureAgeGatedResult;
|
|
}
|
|
tmp6 = result;
|
|
}
|
|
if (channel.isNSFW()) {
|
|
if (tmp6) {
|
|
return true;
|
|
}
|
|
}
|
|
const guild = GuildStore.getGuild(channel.guild_id);
|
|
let tmp9 = null != guild;
|
|
if (tmp9) {
|
|
tmp9 = isGuildNSFW(guild) && tmp6;
|
|
const tmp11 = isGuildNSFW(guild) && tmp6;
|
|
}
|
|
return tmp9;
|
|
}
|
|
}
|
|
function useIsChannelContentGated(channel) {
|
|
_require = channel;
|
|
const shouldShowTiggerPawtect = require("AgeVerificationUtils").useShouldShowTiggerPawtect();
|
|
const obj = require("AgeVerificationUtils");
|
|
items = [GuildNSFWAgreeStore];
|
|
let stateFromStores = require("initialize").useStateFromStores(items, () => {
|
|
let guild_id;
|
|
if (channel != null) {
|
|
guild_id = channel.guild_id;
|
|
}
|
|
return GuildNSFWAgreeStore.didAgree(guild_id);
|
|
});
|
|
const obj2 = require("initialize");
|
|
const items1 = [UserStore];
|
|
const stateFromStores1 = require("initialize").useStateFromStores(items1, () => {
|
|
currentUser = currentUser.getCurrentUser();
|
|
let nsfwAllowed;
|
|
if (currentUser != null) {
|
|
nsfwAllowed = currentUser.nsfwAllowed;
|
|
}
|
|
return false === nsfwAllowed;
|
|
});
|
|
const obj3 = require("initialize");
|
|
let isFeatureAgeGated = require("RegionalFeatureConfigUtils").useIsFeatureAgeGated(require("AgeGatedFeature").AgeGatedFeature.AGE_GATED_SPACES);
|
|
const obj4 = require("RegionalFeatureConfigUtils");
|
|
const items2 = [GuildStore];
|
|
const stateFromStores2 = require("initialize").useStateFromStores(items2, () => {
|
|
let guild_id;
|
|
if (channel != null) {
|
|
guild_id = channel.guild_id;
|
|
}
|
|
return GuildStore.getGuild(guild_id);
|
|
});
|
|
if (stateFromStores) {
|
|
stateFromStores = !stateFromStores1;
|
|
}
|
|
let tmp6 = !stateFromStores;
|
|
if (stateFromStores) {
|
|
if (isFeatureAgeGated) {
|
|
isFeatureAgeGated = shouldShowTiggerPawtect;
|
|
}
|
|
tmp6 = isFeatureAgeGated;
|
|
}
|
|
let tmp7 = null != channel;
|
|
if (tmp7) {
|
|
const isNSFWResult = channel.isNSFW();
|
|
let tmp9 = !isNSFWResult;
|
|
if (isNSFWResult) {
|
|
tmp9 = !tmp6;
|
|
}
|
|
let tmp10 = !tmp9;
|
|
if (tmp9) {
|
|
let tmp11 = null != stateFromStores2;
|
|
if (tmp11) {
|
|
const tmp13 = isGuildNSFW(stateFromStores2);
|
|
let tmp14 = !tmp13;
|
|
if (tmp13) {
|
|
tmp14 = !tmp6;
|
|
}
|
|
tmp11 = !tmp14;
|
|
}
|
|
tmp10 = tmp11;
|
|
}
|
|
tmp7 = tmp10;
|
|
}
|
|
return tmp7;
|
|
}
|
|
const isGuildNSFW = GuildRecord.isGuildNSFW;
|
|
const AgeGateSource = AgeGateConstants.AgeGateSource;
|
|
({ GuildNSFWContentLevel, HelpdeskArticles: closure_9 } = Constants);
|
|
const date = new Date("06/16/2020");
|
|
let items = [, ];
|
|
({ AGE_RESTRICTED: arr[0], EXPLICIT: arr[1] } = GuildNSFWContentLevel);
|
|
let items1 = [, , ];
|
|
({ NSFW_SERVER: arr2[0], NSFW_SERVER_INVITE: arr2[1], NSFW_SERVER_INVITE_EMBED: arr2[2] } = AgeGateSource);
|
|
const set = new Set(items1);
|
|
let result = size.fileFinishedImporting("modules/age_gate/AgeGateUtils.tsx");
|
|
|
|
export const SERVER_AGE_GATE_SOURCES = set;
|
|
export const userNeedsAgeGate = function userNeedsAgeGate() {
|
|
const currentUser = UserStore.getCurrentUser();
|
|
let tmp2 = null != currentUser;
|
|
if (tmp2) {
|
|
tmp2 = SnowflakeUtilsDefault.extractTimestamp(currentUser.id) > date.getTime();
|
|
const extractTimestampResult = SnowflakeUtilsDefault.extractTimestamp(currentUser.id);
|
|
}
|
|
if (tmp2) {
|
|
tmp2 = null == currentUser.nsfwAllowed;
|
|
}
|
|
return tmp2;
|
|
};
|
|
export const guildNeedsAgeGate = function guildNeedsAgeGate(nsfwLevel) {
|
|
return items.includes(nsfwLevel.nsfwLevel);
|
|
};
|
|
export const shouldAgeVerifyForAgeGate = function shouldAgeVerifyForAgeGate() {
|
|
const result = AgeVerificationUtils.shouldShowTiggerPawtect();
|
|
return RegionalFeatureConfigUtils.isFeatureAgeGated(AgeGatedFeature.AgeGatedFeature.AGE_GATED_SPACES) && result;
|
|
};
|
|
export const useShouldAgeVerifyForAgeGate = function useShouldAgeVerifyForAgeGate() {
|
|
let isFeatureAgeGated = RegionalFeatureConfigUtils.useIsFeatureAgeGated(AgeGatedFeature.AgeGatedFeature.AGE_GATED_SPACES);
|
|
if (isFeatureAgeGated) {
|
|
isFeatureAgeGated = obj2.useShouldShowTiggerPawtect();
|
|
}
|
|
return isFeatureAgeGated;
|
|
};
|
|
export const useAgeGateVerifyContentForGuild = function useAgeGateVerifyContentForGuild(stateFromStores) {
|
|
let NSFW_CHANNEL_AGE_VERIFY = dependencyMap;
|
|
const isAgeVerified = AgeVerificationUtils.useIsAgeVerified();
|
|
const tmp3 = isGuildNSFW(stateFromStores);
|
|
items = [UserStore];
|
|
stateFromStores = initialize.useStateFromStores(items, () => {
|
|
currentUser = currentUser.getCurrentUser();
|
|
let nsfwAllowed;
|
|
if (currentUser != null) {
|
|
nsfwAllowed = currentUser.nsfwAllowed;
|
|
}
|
|
return false === nsfwAllowed;
|
|
});
|
|
const isFeatureAgeGated = RegionalFeatureConfigUtils.useIsFeatureAgeGated(AgeGatedFeature.AgeGatedFeature.AGE_GATED_SPACES);
|
|
let shouldShowTiggerPawtect = isFeatureAgeGated;
|
|
if (isFeatureAgeGated) {
|
|
shouldShowTiggerPawtect = obj4.useShouldShowTiggerPawtect();
|
|
}
|
|
const intl = tmp(1114).intl;
|
|
const t = tmp(1114).t;
|
|
const stringResult = intl.string(tmp3 ? t.xi46lg : t.ZmwvDc);
|
|
const obj5 = { title: null, description: null, agreement: null, modalType: null };
|
|
if (shouldShowTiggerPawtect) {
|
|
obj5.title = stringResult;
|
|
const intl6 = tmp(1114).intl;
|
|
if (!isAgeVerified) {
|
|
const string = intl6.string;
|
|
const t4 = tmp(1114).t;
|
|
if (tmp3) {
|
|
let stringResult1 = string(t4.V6Gmu9);
|
|
} else {
|
|
stringResult1 = string(t4["5rygLk"]);
|
|
}
|
|
obj5.description = stringResult1;
|
|
const intl7 = tmp(1114).intl;
|
|
obj5.agreement = intl7.string(tmp(1114).t.FDSSia);
|
|
obj5.modalType = tmp(8478).NsfwSpaceWarningModalType.NSFW_CHANNEL_AGE_VERIFY;
|
|
}
|
|
const format = intl6.format;
|
|
let string2 = tmp(1114).t;
|
|
if (tmp3) {
|
|
let formatResult = format(string2["8tk6bB"], {});
|
|
} else {
|
|
formatResult = format(string2.XQZvwn, {});
|
|
}
|
|
obj5.description = formatResult;
|
|
const intl8 = tmp(1114).intl;
|
|
string2 = intl8.string;
|
|
obj5.agreement = string2(tmp(1114).t.Zt4Mf4);
|
|
NSFW_CHANNEL_AGE_VERIFY = tmp(8478).NsfwSpaceWarningModalType.NSFW_CHANNEL_AGE_VERIFY;
|
|
obj5.modalType = NSFW_CHANNEL_AGE_VERIFY;
|
|
} else if (stateFromStores) {
|
|
const intl4 = tmp(1114).intl;
|
|
const t3 = tmp(1114).t;
|
|
obj5.title = intl4.string(tmp3 ? t3["H0SG/g"] : t3.NEabBa);
|
|
const intl5 = tmp(1114).intl;
|
|
let NSFW_CHANNEL_UNDERAGE = tmp(1114).t;
|
|
const obj6 = { helpURL: HelpdeskUtilsDefault.getArticleURL(constants.NSFW_AGE_GATING) };
|
|
obj5.description = intl5.format(tmp3 ? NSFW_CHANNEL_UNDERAGE["6++3cX"] : NSFW_CHANNEL_UNDERAGE["2kHZes"], obj6);
|
|
NSFW_CHANNEL_UNDERAGE = tmp(8478).NsfwSpaceWarningModalType.NSFW_CHANNEL_UNDERAGE;
|
|
obj5.modalType = NSFW_CHANNEL_UNDERAGE;
|
|
const tmp9 = tmp3 ? NSFW_CHANNEL_UNDERAGE["6++3cX"] : NSFW_CHANNEL_UNDERAGE["2kHZes"];
|
|
} else {
|
|
obj5.title = stringResult;
|
|
const intl2 = tmp(1114).intl;
|
|
const t2 = tmp(1114).t;
|
|
obj5.description = intl2.string(tmp3 ? t2.ZtuRts : t2.E4Cd5I);
|
|
const intl3 = tmp(1114).intl;
|
|
obj5.agreement = intl3.string(tmp(1114).t.wVq7uo);
|
|
obj5.modalType = tmp(8478).NsfwSpaceWarningModalType.NSFW_CHANNEL_VERIFIED;
|
|
return obj5;
|
|
}
|
|
};
|
|
export const useAgeGateVerifyContent = function useAgeGateVerifyContent(source) {
|
|
const isAgeVerified = AgeVerificationUtils.useIsAgeVerified();
|
|
const isFeatureAgeGated = RegionalFeatureConfigUtils.useIsFeatureAgeGated(AgeGatedFeature.AgeGatedFeature.AGE_GATED_SPACES);
|
|
let shouldShowTiggerPawtect = isFeatureAgeGated;
|
|
if (isFeatureAgeGated) {
|
|
shouldShowTiggerPawtect = obj3.useShouldShowTiggerPawtect();
|
|
}
|
|
initialize;
|
|
[][0] = UserStore;
|
|
if (source !== AgeGateSource.JOIN_LARGE_GUILD_UNDERAGE) {
|
|
if (source !== tmp6.ACCESS_LARGE_GUILD_UNDERAGE) {
|
|
if (isAgeVerified) {
|
|
const obj4 = { verifyAgreementButtonText: null, verifyGateDescription: null, verifyTitle: null };
|
|
const intl9 = tmp(1114).intl;
|
|
obj4.verifyAgreementButtonText = intl9.string(tmp(1114).t.Zt4Mf4);
|
|
const intl10 = tmp(1114).intl;
|
|
const format = intl10.format;
|
|
const t2 = tmp(1114).t;
|
|
if (tmp7) {
|
|
let formatResult = format(t2["8tk6bB"], {});
|
|
} else {
|
|
formatResult = format(t2.XQZvwn, {});
|
|
}
|
|
obj4.verifyGateDescription = formatResult;
|
|
const intl11 = tmp(1114).intl;
|
|
const string3 = intl11.string;
|
|
let xi46lg2 = tmp(1114).t;
|
|
if (tmp7) {
|
|
xi46lg2 = xi46lg2.xi46lg;
|
|
let string3Result = string3(xi46lg2);
|
|
} else {
|
|
string3Result = string3(xi46lg2.ZmwvDc);
|
|
}
|
|
obj4.verifyTitle = string3Result;
|
|
} else {
|
|
if (source === tmp6.LARGE_GUILD) {
|
|
const obj5 = { verifyTitle: null, verifyGateDescription: null, verifyAgreementButtonText: null };
|
|
const intl6 = tmp(1114).intl;
|
|
obj5.verifyTitle = intl6.string(tmp(1114).t["7ymzsL"]);
|
|
const intl7 = tmp(1114).intl;
|
|
obj5.verifyGateDescription = intl7.string(tmp(1114).t.SxY4IW);
|
|
const intl8 = tmp(1114).intl;
|
|
obj5.verifyAgreementButtonText = intl8.string(tmp(1114).t.FDSSia);
|
|
let obj7 = obj5;
|
|
} else {
|
|
if (tmp9) {
|
|
if (tmp7) {
|
|
if (!shouldShowTiggerPawtect) {
|
|
obj7 = { verifyTitle: null, verifyGateDescription: null, verifyAgreementButtonText: null };
|
|
const intl = tmp(1114).intl;
|
|
obj7.verifyTitle = intl.string(tmp(1114).t["H0SG/g"]);
|
|
const intl2 = tmp(1114).intl;
|
|
const obj8 = { helpURL: HelpdeskUtilsDefault.getArticleURL(constants.AGE_GATE) };
|
|
obj7.verifyGateDescription = intl2.format(tmp(1114).t["6++3cX"], obj8);
|
|
}
|
|
}
|
|
}
|
|
const obj9 = { verifyAgreementButtonText: null, verifyGateDescription: null, verifyTitle: null };
|
|
const intl3 = tmp(1114).intl;
|
|
obj9.verifyAgreementButtonText = intl3.string(tmp(1114).t.FDSSia);
|
|
const intl4 = tmp(1114).intl;
|
|
const string = intl4.string;
|
|
const t = tmp(1114).t;
|
|
if (tmp7) {
|
|
let stringResult = string(t.V6Gmu9);
|
|
} else {
|
|
stringResult = string(t["5rygLk"]);
|
|
}
|
|
obj9.verifyGateDescription = stringResult;
|
|
const intl5 = tmp(1114).intl;
|
|
const string2 = intl5.string;
|
|
let xi46lg = tmp(1114).t;
|
|
if (tmp7) {
|
|
xi46lg = xi46lg.xi46lg;
|
|
let string2Result = string2(xi46lg);
|
|
} else {
|
|
string2Result = string2(xi46lg.ZmwvDc);
|
|
}
|
|
obj9.verifyTitle = string2Result;
|
|
}
|
|
return obj7;
|
|
}
|
|
}
|
|
}
|
|
if (source === AgeGateSource.JOIN_LARGE_GUILD_UNDERAGE) {
|
|
let MjQbfi = tmp(1114).t["u/xsK9"];
|
|
} else {
|
|
MjQbfi = tmp(1114).t.MjQbfi;
|
|
}
|
|
const intl12 = tmp(1114).intl;
|
|
const string4 = intl12.string;
|
|
const t3 = tmp(1114).t;
|
|
if (isAgeVerified) {
|
|
let string4Result = string4(t3.SAoMVJ);
|
|
} else {
|
|
string4Result = string4(t3.SxY4IW);
|
|
}
|
|
const intl13 = tmp(1114).intl;
|
|
const string5 = intl13.string;
|
|
const t4 = tmp(1114).t;
|
|
if (isAgeVerified) {
|
|
let string5Result = string5(t4.Zt4Mf4);
|
|
} else {
|
|
string5Result = string5(t4.FDSSia);
|
|
}
|
|
const obj10 = { verifyTitle: null, verifyGateDescription: null, verifyAgreementButtonText: null };
|
|
const intl14 = tmp(1114).intl;
|
|
obj10.verifyTitle = intl14.string(MjQbfi);
|
|
obj10.verifyGateDescription = string4Result;
|
|
obj10.verifyAgreementButtonText = string5Result;
|
|
return obj10;
|
|
};
|
|
export const shouldShowAgeGateForCurrentUser = function shouldShowAgeGateForCurrentUser() {
|
|
const currentUser = UserStore.getCurrentUser();
|
|
if (null == currentUser) {
|
|
return false;
|
|
} else {
|
|
const result = AgeVerificationUtils.shouldShowTiggerPawtect();
|
|
const tmp5 = RegionalFeatureConfigUtils.isFeatureAgeGated(AgeGatedFeature.AgeGatedFeature.AGE_GATED_SPACES) && result;
|
|
return true !== currentUser.nsfwAllowed || RegionalFeatureConfigUtils.isFeatureAgeGated(AgeGatedFeature.AgeGatedFeature.AGE_GATED_SPACES) && result;
|
|
}
|
|
};
|
|
export const shouldShowAgeGateForGuildContentLevel = function shouldShowAgeGateForGuildContentLevel(arg0) {
|
|
const currentUser = UserStore.getCurrentUser();
|
|
let flag = false;
|
|
if (null != currentUser) {
|
|
const result = AgeVerificationUtils.shouldShowTiggerPawtect();
|
|
const tmp5 = RegionalFeatureConfigUtils.isFeatureAgeGated(AgeGatedFeature.AgeGatedFeature.AGE_GATED_SPACES) && result;
|
|
flag = true !== currentUser.nsfwAllowed || RegionalFeatureConfigUtils.isFeatureAgeGated(AgeGatedFeature.AgeGatedFeature.AGE_GATED_SPACES) && result;
|
|
const tmp6 = true !== currentUser.nsfwAllowed || RegionalFeatureConfigUtils.isFeatureAgeGated(AgeGatedFeature.AgeGatedFeature.AGE_GATED_SPACES) && result;
|
|
}
|
|
if (flag) {
|
|
if (null != arg0) {
|
|
const guild = GuildStore.getGuild(arg0);
|
|
let tmp10 = null != guild;
|
|
if (tmp10) {
|
|
tmp10 = isGuildNSFW(guild);
|
|
}
|
|
return tmp10;
|
|
}
|
|
}
|
|
return false;
|
|
};
|
|
export const shouldShowAgeGateForChannelId = function shouldShowAgeGateForChannelId(id) {
|
|
const currentUser = UserStore.getCurrentUser();
|
|
let flag = false;
|
|
if (null != currentUser) {
|
|
const result = AgeVerificationUtils.shouldShowTiggerPawtect();
|
|
const tmp5 = RegionalFeatureConfigUtils.isFeatureAgeGated(AgeGatedFeature.AgeGatedFeature.AGE_GATED_SPACES) && result;
|
|
flag = true !== currentUser.nsfwAllowed || RegionalFeatureConfigUtils.isFeatureAgeGated(AgeGatedFeature.AgeGatedFeature.AGE_GATED_SPACES) && result;
|
|
const tmp6 = true !== currentUser.nsfwAllowed || RegionalFeatureConfigUtils.isFeatureAgeGated(AgeGatedFeature.AgeGatedFeature.AGE_GATED_SPACES) && result;
|
|
}
|
|
let tmp7 = !flag;
|
|
if (flag) {
|
|
tmp7 = null == id;
|
|
}
|
|
let tmp8 = !tmp7;
|
|
if (!tmp7) {
|
|
tmp8 = isChannelContentGated(ChannelStore.getChannel(id));
|
|
}
|
|
return tmp8;
|
|
};
|
|
export { shouldShowAgeGateForVoiceChannel };
|
|
export const maybeOpenAgeGateForVoiceChannel = function maybeOpenAgeGateForVoiceChannel(id) {
|
|
let flag = shouldShowAgeGateForVoiceChannel(id);
|
|
if (flag) {
|
|
AgeGateModalActionCreators.openAgeGateModal(AgeGateSource.NSFW_VOICE_CHANNEL);
|
|
flag = true;
|
|
}
|
|
return flag;
|
|
};
|
|
export const maybeShowAgeGate = function maybeShowAgeGate(guildId, channelId, JOIN_LARGE_GUILD_UNDERAGE) {
|
|
const currentUser = UserStore.getCurrentUser();
|
|
let flag = false;
|
|
if (null != currentUser) {
|
|
const result = AgeVerificationUtils.shouldShowTiggerPawtect();
|
|
const tmp5 = RegionalFeatureConfigUtils.isFeatureAgeGated(AgeGatedFeature.AgeGatedFeature.AGE_GATED_SPACES) && result;
|
|
flag = true !== currentUser.nsfwAllowed || RegionalFeatureConfigUtils.isFeatureAgeGated(AgeGatedFeature.AgeGatedFeature.AGE_GATED_SPACES) && result;
|
|
const tmp6 = true !== currentUser.nsfwAllowed || RegionalFeatureConfigUtils.isFeatureAgeGated(AgeGatedFeature.AgeGatedFeature.AGE_GATED_SPACES) && result;
|
|
}
|
|
let flag3 = false;
|
|
if (flag) {
|
|
flag3 = false;
|
|
if (null != guildId) {
|
|
const guild = GuildStore.getGuild(guildId);
|
|
let tmp10 = null != guild;
|
|
if (tmp10) {
|
|
tmp10 = isGuildNSFW(guild);
|
|
}
|
|
flag3 = tmp10;
|
|
}
|
|
}
|
|
let NSFW_SERVER = JOIN_LARGE_GUILD_UNDERAGE;
|
|
if (flag3) {
|
|
if (null == NSFW_SERVER) {
|
|
NSFW_SERVER = AgeGateSource.NSFW_SERVER;
|
|
}
|
|
AgeGateModalActionCreators.openAgeGateModal(NSFW_SERVER);
|
|
} else {
|
|
const currentUser1 = obj.getCurrentUser();
|
|
let tmp13 = null != currentUser1 && null == currentUser1.nsfwAllowed;
|
|
if (tmp13) {
|
|
const currentUser2 = obj.getCurrentUser();
|
|
let flag4 = false;
|
|
if (null != currentUser2) {
|
|
const result1 = AgeVerificationUtils.shouldShowTiggerPawtect();
|
|
const tmp18 = RegionalFeatureConfigUtils.isFeatureAgeGated(AgeGatedFeature.AgeGatedFeature.AGE_GATED_SPACES) && result1;
|
|
flag4 = true !== currentUser2.nsfwAllowed || RegionalFeatureConfigUtils.isFeatureAgeGated(AgeGatedFeature.AgeGatedFeature.AGE_GATED_SPACES) && result1;
|
|
const tmp19 = true !== currentUser2.nsfwAllowed || RegionalFeatureConfigUtils.isFeatureAgeGated(AgeGatedFeature.AgeGatedFeature.AGE_GATED_SPACES) && result1;
|
|
}
|
|
let tmp21 = !flag4;
|
|
if (flag4) {
|
|
tmp21 = null == channelId;
|
|
}
|
|
let tmp22 = !tmp21;
|
|
if (!tmp21) {
|
|
tmp22 = isChannelContentGated(ChannelStore.getChannel(channelId));
|
|
}
|
|
tmp13 = tmp22;
|
|
}
|
|
if (tmp13) {
|
|
let NSFW_CHANNEL = NSFW_SERVER;
|
|
if (NSFW_SERVER == null) {
|
|
NSFW_CHANNEL = AgeGateSource.NSFW_CHANNEL;
|
|
}
|
|
AgeGateModalActionCreators.openAgeGateModal(NSFW_CHANNEL);
|
|
}
|
|
}
|
|
};
|
|
export const isChannelOrGuildNSFW = function isChannelOrGuildNSFW(channel) {
|
|
let tmp = null != channel;
|
|
if (tmp) {
|
|
let isNSFWResult = channel.isNSFW();
|
|
if (!isNSFWResult) {
|
|
isNSFWResult = isGuildNSFW(GuildStore.getGuild(channel.guild_id));
|
|
}
|
|
tmp = isNSFWResult;
|
|
}
|
|
return tmp;
|
|
};
|
|
export const isChannelAgeVerificationGated = function isChannelAgeVerificationGated(isNSFW) {
|
|
if (null == isNSFW) {
|
|
return false;
|
|
} else {
|
|
let tmp4 = null != isNSFW;
|
|
const result = AgeVerificationUtils.shouldShowTiggerPawtect();
|
|
if (tmp4) {
|
|
let isNSFWResult = isNSFW.isNSFW();
|
|
if (!isNSFWResult) {
|
|
isNSFWResult = isGuildNSFW(GuildStore.getGuild(isNSFW.guild_id));
|
|
}
|
|
tmp4 = isNSFWResult;
|
|
}
|
|
if (tmp4) {
|
|
tmp4 = result;
|
|
}
|
|
return tmp4;
|
|
}
|
|
};
|
|
export const userCannotSeeNSFWContent = function userCannotSeeNSFWContent(channel) {
|
|
if (null == channel) {
|
|
return false;
|
|
} else {
|
|
const currentUser = UserStore.getCurrentUser();
|
|
if (currentUser != null) {
|
|
const nsfwAllowed = currentUser.nsfwAllowed;
|
|
}
|
|
let tmp3 = null != channel;
|
|
if (tmp3) {
|
|
let isNSFWResult = channel.isNSFW();
|
|
if (!isNSFWResult) {
|
|
isNSFWResult = isGuildNSFW(GuildStore.getGuild(channel.guild_id));
|
|
}
|
|
tmp3 = isNSFWResult;
|
|
}
|
|
if (tmp3) {
|
|
tmp3 = true !== nsfwAllowed;
|
|
}
|
|
return tmp3;
|
|
}
|
|
};
|
|
export { isChannelContentGated };
|
|
export { useIsChannelContentGated };
|
|
export const useShouldHideChannelContent = function useShouldHideChannelContent(stateFromStores) {
|
|
const tmp = useIsChannelContentGated(stateFromStores);
|
|
let isChannelSpoilerGated = tmp;
|
|
if (!tmp) {
|
|
isChannelSpoilerGated = obj.useIsChannelSpoilerGated(stateFromStores);
|
|
}
|
|
return isChannelSpoilerGated;
|
|
};
|
|
export const isCurrentUserMissingDateOfBirth = function isCurrentUserMissingDateOfBirth() {
|
|
const currentUser = UserStore.getCurrentUser();
|
|
return null != currentUser && null == currentUser.nsfwAllowed;
|
|
};
|
|
export const shouldAgeVerifyForSettingsToggles = function shouldAgeVerifyForSettingsToggles() {
|
|
let isFeatureAgeGatedResult = RegionalFeatureConfigUtils.isFeatureAgeGated(AgeGatedFeature.AgeGatedFeature.COMMANDS_TOGGLE);
|
|
if (isFeatureAgeGatedResult) {
|
|
isFeatureAgeGatedResult = obj2.shouldShowTiggerPawtect();
|
|
}
|
|
return isFeatureAgeGatedResult;
|
|
};
|
|
export const useShouldAgeVerifyForSettingsToggles = function useShouldAgeVerifyForSettingsToggles() {
|
|
let isFeatureAgeGated = RegionalFeatureConfigUtils.useIsFeatureAgeGated(AgeGatedFeature.AgeGatedFeature.COMMANDS_TOGGLE);
|
|
if (isFeatureAgeGated) {
|
|
isFeatureAgeGated = obj2.useShouldShowTiggerPawtect();
|
|
}
|
|
return isFeatureAgeGated;
|
|
};
|