decord/stable/source/modules/self_mod/ChannelSafetyWarningsManager.tsx
2026-10-06 22:12:49 +00:00

98 lines
4.2 KiB
TypeScript

// Module ID: 17116
// Function ID: 17117
// Name: ChannelSafetyWarningsManager
// Dependencies: [2051, 2102, 9565, 9606, 17117, 6540, 2]
// Module 17116 (ChannelSafetyWarningsManager)
import SelfModInappropriateConversationExperiment from "SelfModInappropriateConversationExperiment" /* 9565 */;
import InappropriateConversationUtils from "InappropriateConversationUtils" /* 9606 */;
import showTakeoverModal2 from "showTakeoverModal" /* 17117 */;
import ChannelStore from "ChannelStore" /* 2051 */;
import SelectedChannelStore from "SelectedChannelStore" /* 2102 */;
import AutomaticLifecycleManager from "AutomaticLifecycleManager" /* 6540 */;
import size from "module_2" /* 2 */;
function handleChannelSelect(channelId) {
channelId = channelId.channelId;
if (null == channelId) {
return false;
} else {
const obj5 = SelfModInappropriateConversationExperiment;
if (obj5.isEligibleForInappropriateConversationWarning({ location: "channel_select" })) {
const tmp5Result = InappropriateConversationUtils;
if (tmp5Result.getSafetyAlertsSettingOrDefault()) {
const channel = ChannelStore.getChannel(channelId);
if (null != channel) {
if (channel.isDM()) {
const tmp5Result3 = InappropriateConversationUtils;
const inappropriateConversationTakeoverForChannel = tmp5Result3.getInappropriateConversationTakeoverForChannel(channelId);
let flag3 = null != inappropriateConversationTakeoverForChannel;
if (flag3) {
({ id: obj4.warningId, type: obj4.warningType } = inappropriateConversationTakeoverForChannel);
const obj = { warningId: null, warningType: null, senderId: channel.getRecipientId(), channelId };
const showTakeoverModal = showTakeoverModal2.showTakeoverModal;
showTakeoverModal2;
showTakeoverModal(obj);
flag3 = true;
}
return flag3;
}
}
return false;
} else {
return false;
}
} else {
return false;
}
}
}
function handleChannelUpdates(channels) {
channels = channels.channels;
let currentlySelectedChannelId;
const obj = SelfModInappropriateConversationExperiment;
if (obj.isEligibleForInappropriateConversationWarning({ location: "channel_updates" })) {
const tmpResult = InappropriateConversationUtils;
if (tmpResult.getSafetyAlertsSettingOrDefault()) {
currentlySelectedChannelId = SelectedChannelStore.getCurrentlySelectedChannelId();
if (null == currentlySelectedChannelId) {
return false;
} else {
const found = channels.find((id) => id.id === currentlySelectedChannelId);
if (null == found) {
return false;
} else {
const tmpResult3 = InappropriateConversationUtils;
const inappropriateConversationTakeoverForChannel = tmpResult3.getInappropriateConversationTakeoverForChannel(found.id);
let flag3 = !(null == inappropriateConversationTakeoverForChannel || !found.isDM());
null == inappropriateConversationTakeoverForChannel || !found.isDM();
if (flag3) {
({ id: obj3.warningId, type: obj3.warningType } = inappropriateConversationTakeoverForChannel);
const obj2 = { warningId: null, warningType: null, senderId: found.getRecipientId(), channelId: found.id };
const showTakeoverModal = showTakeoverModal2.showTakeoverModal;
showTakeoverModal2;
showTakeoverModal(obj2);
flag3 = true;
}
return flag3;
}
}
} else {
return false;
}
} else {
return false;
}
}
class ChannelSafetyWarningsManager extends AutomaticLifecycleManager {
constructor() {
const applyArgumentsResult = HermesBuiltin.applyArguments(this, new.target);
const obj = { CHANNEL_SELECT: handleChannelSelect, CHANNEL_UPDATES: handleChannelUpdates };
applyArgumentsResult.actions = obj;
return applyArgumentsResult;
}
}
const channelSafetyWarningsManager = new ChannelSafetyWarningsManager();
const result = size.fileFinishedImporting("modules/self_mod/ChannelSafetyWarningsManager.tsx");
export default channelSafetyWarningsManager;