decord/source/modules/age_assurance/AgeVerificationManager.tsx

125 lines
4.8 KiB
TypeScript
Raw Normal View History

// Module ID: 17424
// Function ID: 17425
// Name: AgeVerificationManager
// Dependencies: [1957, 4857, 2011, 1371, 1074, 8517, 3, 1095, 7559, 7407, 7221, 1894, 5504, 5505, 8710, 5353, 2]
2026-07-20 16:05:17 +00:00
// Module 17424 (AgeVerificationManager)
import LoggerDefault from "Logger" /* 3 */;
import MessageEmbedTypes from "MessageEmbedTypes" /* 1095 */;
import Server from "Server" /* 1894 */;
import ChannelMessagesDefault from "ChannelMessages" /* 5353 */;
import RegionalFeatureConfigUtils from "RegionalFeatureConfigUtils" /* 5504 */;
import AgeGatedFeature from "AgeGatedFeature" /* 5505 */;
import ManualReviewActionCreators from "ManualReviewActionCreators" /* 8710 */;
import ChannelStore from "ChannelStore" /* 1957 */;
import MessageStore from "MessageStore" /* 4857 */;
import SelectedChannelStore from "SelectedChannelStore" /* 2011 */;
import UserStore from "UserStore" /* 1371 */;
import AutomaticLifecycleManager from "AutomaticLifecycleManager" /* 7221 */;
2026-07-23 10:11:24 +00:00
require = fn;
2026-07-20 16:05:17 +00:00
function handleMessageCreate(channelId) {
const message = MessageStore.getMessage(channelId.channelId, channelId.message.id);
2026-08-31 15:47:37 +00:00
const AGE_VERIFICATION_SYSTEM_NOTIFICATION = MessageEmbedTypes.MessageEmbedTypes.AGE_VERIFICATION_SYSTEM_NOTIFICATION;
2026-07-20 16:05:17 +00:00
}
const transformUser = fn(1371).transformUser;
const Constants = fn(1074);
({ ChannelTypes: closure_8, MAX_MESSAGES_PER_CHANNEL: closure_9 } = Constants);
const SafetyToastType = fn(8517).SafetyToastType;
let closure_10 = new LoggerDefault("AgeVerificationManager");
const prototype = function AgeVerificationManager() {
2026-07-29 08:29:29 +00:00
const applyArgumentsResult = HermesBuiltin.applyArguments(new.target, new.target);
2026-08-24 06:08:38 +00:00
require = applyArgumentsResult;
2026-07-29 08:29:29 +00:00
applyArgumentsResult._previousAgeVerificationStatus = null;
applyArgumentsResult.handlePostConnectionOpen = function handlePostConnectionOpen() {
const currentUser = UserStore.getCurrentUser();
2026-07-29 08:29:29 +00:00
let prop;
if (currentUser != null) {
prop = currentUser.ageVerificationStatus;
}
if (prop == null) {
prop = null;
}
applyArgumentsResult._previousAgeVerificationStatus = prop;
2026-07-29 08:29:29 +00:00
};
applyArgumentsResult.handleCurrentUserUpdate = function handleCurrentUserUpdate(user) {
let channelId;
2026-08-24 06:08:38 +00:00
c1 = undefined;
let prop = transformUser(user.user).ageVerificationStatus;
2026-07-29 08:29:29 +00:00
if (prop == null) {
prop = null;
}
2026-08-31 15:47:37 +00:00
let isFeatureAgeGatedResult = tmp5;
if (applyArgumentsResult._previousAgeVerificationStatus !== prop) {
isFeatureAgeGatedResult = prop === Server.AgeVerificationStatusUkAndAusOnly.VERIFIED_ADULT;
2026-07-29 08:29:29 +00:00
}
if (isFeatureAgeGatedResult) {
isFeatureAgeGatedResult = RegionalFeatureConfigUtils.isFeatureAgeGated(AgeGatedFeature.AgeGatedFeature.AGE_GATED_SPACES);
2026-08-31 15:47:37 +00:00
}
if (applyArgumentsResult._previousAgeVerificationStatus !== prop) {
const result = ManualReviewActionCreators.invalidateManualReviewCache();
2026-07-29 08:29:29 +00:00
}
try {
if (isFeatureAgeGatedResult) {
channelId = SelectedChannelStore.getChannelId();
2026-07-29 08:29:29 +00:00
c1 = false;
const item = ChannelMessagesDefault.forEach((channelId) => {
2026-07-29 08:29:29 +00:00
channelId = channelId.channelId;
channel = channel.getChannel(channelId);
2026-07-29 08:29:29 +00:00
let nsfw;
if (channel != null) {
nsfw = channel.nsfw;
}
if (nsfw) {
ChannelMessagesDefault.clear(channelId);
2026-07-29 08:29:29 +00:00
if (channelId === channelId) {
c1 = true;
2026-07-29 08:29:29 +00:00
}
}
});
2026-08-31 15:47:37 +00:00
let tmp20 = c1;
2026-07-29 08:29:29 +00:00
if (c1) {
2026-08-31 15:47:37 +00:00
tmp20 = null != tmp16;
2026-07-29 08:29:29 +00:00
}
2026-08-31 15:47:37 +00:00
if (tmp20) {
2026-07-29 08:29:29 +00:00
(function handleLoadChannelMessages(channelId) {
const messages = _true(7559).fetchMessages({ channelId, limit });
2026-08-31 15:47:37 +00:00
})(tmp16);
2026-07-29 08:29:29 +00:00
(function handleLoadForumPosts(arg0) {
channel = channel.getChannel(arg0);
let type;
if (channel != null) {
type = channel.type;
}
let tmp4 = type !== constants.GUILD_FORUM;
if (tmp4) {
let type1;
if (channel != null) {
type1 = channel.type;
}
tmp4 = type1 !== tmp3.GUILD_MEDIA;
}
if (!tmp4) {
channelId(7407).preloadForumThreads(channel);
const obj = channelId(7407);
2026-07-29 08:29:29 +00:00
}
2026-08-31 15:47:37 +00:00
})(tmp16);
2026-07-29 08:29:29 +00:00
}
}
applyArgumentsResult._previousAgeVerificationStatus = prop;
2026-08-31 15:47:37 +00:00
} catch (tmp25) {
2026-07-29 08:29:29 +00:00
tmp._previousAgeVerificationStatus = tmp2;
2026-08-31 15:47:37 +00:00
throw tmp25;
2026-07-29 08:29:29 +00:00
}
};
applyArgumentsResult.actions = { POST_CONNECTION_OPEN: applyArgumentsResult.handlePostConnectionOpen, CURRENT_USER_UPDATE: applyArgumentsResult.handleCurrentUserUpdate, MESSAGE_CREATE: handleMessageCreate };
return applyArgumentsResult;
}.prototype;
class prototype extends tmp4 {
}
const prototype1 = new prototype();
const size = fn(2);
let result = size.fileFinishedImporting("modules/age_assurance/AgeVerificationManager.tsx");
2026-07-20 16:05:17 +00:00
export default prototype1;