293 lines
16 KiB
TypeScript
293 lines
16 KiB
TypeScript
/* Metro module 11459; source: modules/guild_automod/GuildAutomodActionCreators.tsx; dependencies: [5, 1867, 3784, 661, 11460, 1360, 21, 507, 11453, 4863, 5061, 694, 2] */
|
|
import Module00005 from '../../by-id/module-00005.js'; /* Metro dependency 5 */
|
|
import Dispatcher from '../../Dispatcher.tsx'; /* Metro dependency 694 */
|
|
import GuildStore from '../../stores/GuildStore.tsx'; /* Metro dependency 1867 */
|
|
import PermissionStore from '../../stores/PermissionStore.tsx'; /* Metro dependency 3784 */
|
|
import * as FileImportTrackerModule from '../../by-id/module-00002-FileImportTracker.js'; /* Metro dependency 2 */
|
|
import * as HTTPUtilsModule from '../../external/discord_common/js/packages/http-utils/HTTPUtils.tsx'; /* Metro dependency 507 */
|
|
import * as ConstantsModule from '../../Constants.tsx'; /* Metro dependency 661 */
|
|
import * as GlobalUtilsModule from '../../utils/GlobalUtils.tsx'; /* Metro dependency 1360 */
|
|
import * as AppAnalyticsUtilsModule from '../app_analytics/AppAnalyticsUtils.tsx'; /* Metro dependency 4863 */
|
|
import * as AutomodFeedbackModule from './AutomodFeedback.tsx'; /* Metro dependency 5061 */
|
|
import * as DataUtilsModule from './DataUtils.tsx'; /* Metro dependency 11460 */
|
|
|
|
function _fun87719(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#87719, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11645:6, offset: 0x01fc91dc, size: 405 bytes, params: 8, frame: 19
|
|
const env0_0 = require;
|
|
const Object = global.Object;
|
|
Object.defineProperty(exports, '__esModule', {value: true});
|
|
(FileImportTrackerModule).fileFinishedImporting('modules/guild_automod/GuildAutomodActionCreators.tsx');
|
|
exports.validateAutomodRule = function() {
|
|
return _validateAutomodRule.apply(this, arguments);
|
|
};
|
|
exports.createAutomodRule = function() {
|
|
return _createAutomodRule.apply(this, arguments);
|
|
};
|
|
exports.updateAutomodRule = function() {
|
|
return _updateAutomodRule.apply(this, arguments);
|
|
};
|
|
exports.deleteAutomodRule = function() {
|
|
return _deleteAutomodRule.apply(this, arguments);
|
|
};
|
|
exports.fetchAutomodRules = function() {
|
|
return _fetchAutomodRules.apply(this, arguments);
|
|
};
|
|
exports.executeAlertAction = function() {
|
|
return _executeAlertAction.apply(this, arguments);
|
|
};
|
|
exports.removeMentionRaidRestrictionWithFeedback = removeMentionRaidRestrictionWithFeedback;
|
|
exports.clearMentionRaidDetected = clearMentionRaidDetected;
|
|
function _transformClientActionToApiAction({type, metadata}) { // fn#87720, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11645:185, offset: 0x01fc9371, size: 63 bytes, params: 2, frame: 13
|
|
const object = {};
|
|
object.type = type;
|
|
object.metadata = (require(11460) /* metro dependency 11460: DataUtils */)._transformMetadataToSnakeCase(metadata);
|
|
return object;
|
|
}
|
|
|
|
function _transformClientRuleToApiRule({triggerMetadata, id, name, guildId, eventType, triggerType, actions, enabled, creatorId, position, exemptChannels, exemptRoles}) { // fn#87721, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11645:310, offset: 0x01fc93b0, size: 276 bytes, params: 2, frame: 18
|
|
const value2 = (DataUtilsModule)._transformMetadataToSnakeCase(triggerMetadata);
|
|
if (value2 != null) {
|
|
delete value2.keywordLists;
|
|
}
|
|
const object = {};
|
|
object.id = id;
|
|
object.name = name;
|
|
object.guild_id = guildId;
|
|
object.event_type = eventType;
|
|
object.trigger_type = triggerType;
|
|
object.trigger_metadata = value2;
|
|
const value3 = actions.filter((GlobalUtilsModule).isNotNullish);
|
|
object.actions = value3.map(_transformClientActionToApiAction);
|
|
object.enabled = enabled;
|
|
object.creator_id = creatorId;
|
|
object.position = position;
|
|
let Array = global.Array;
|
|
object.exempt_channels = Array.from(exemptChannels ?? []);
|
|
Array = global.Array;
|
|
object.exempt_roles = Array.from(exemptRoles ?? []);
|
|
return object;
|
|
}
|
|
|
|
function _transformApiActionToClientAction({type, metadata}) { // fn#87722, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11645:828, offset: 0x01fc94c4, size: 63 bytes, params: 2, frame: 13
|
|
const object = {};
|
|
object.type = type;
|
|
object.metadata = (require(11460) /* metro dependency 11460: DataUtils */)._transformMetadataToCamelCase(metadata);
|
|
return object;
|
|
}
|
|
|
|
function _transformApiRuletoClientRule({id, name, guild_id, event_type, trigger_type, trigger_metadata, actions, enabled, creator_id, position, exempt_channels, exempt_roles}) { // fn#87723, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11645:953, offset: 0x01fc9503, size: 363 bytes, params: 2, frame: 18
|
|
var r3;
|
|
var value;
|
|
var fromTimestamp;
|
|
var Date;
|
|
const object = {};
|
|
if (id != null) {
|
|
r3 = id;
|
|
} else {
|
|
value = importDefault(21) /* metro dependency 21: SnowflakeUtils */;
|
|
fromTimestamp = value.fromTimestamp;
|
|
Date = global.Date;
|
|
value = Reflect.apply(fromTimestamp, value, [Date.now()]);
|
|
r3 = value;
|
|
}
|
|
object.id = r3;
|
|
object.name = name;
|
|
object.guildId = guild_id;
|
|
object.eventType = event_type;
|
|
object.triggerType = trigger_type;
|
|
object.triggerMetadata = (require(11460) /* metro dependency 11460: DataUtils */)._transformMetadataToCamelCase(trigger_metadata);
|
|
const value2 = actions.filter((GlobalUtilsModule).isNotNullish);
|
|
object.actions = value2.map(_transformApiActionToClientAction);
|
|
object.enabled = enabled;
|
|
object.creatorId = creator_id;
|
|
object.position = position;
|
|
let Set = global.Set;
|
|
object.exemptChannels = new Set(exempt_channels ?? []);
|
|
Set = global.Set;
|
|
object.exemptRoles = new Set(exempt_roles ?? []);
|
|
if (object.triggerMetadata != null) {
|
|
delete object.triggerMetadata.keywordLists;
|
|
}
|
|
return object;
|
|
}
|
|
|
|
function _validateAutomodRule() { // fn#87724, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11645:1545, offset: 0x01fc966e, size: 50 bytes, params: 1, frame: 14
|
|
return Module00005(_fun87726).apply(this, arguments);
|
|
function* _fun87726(a0) { // fn#87726, original name: ?anon_0_, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11645:1608, offset: 0x01fc96ab, size: 154 bytes, params: 2, frame: 18
|
|
if (false) {
|
|
return undefined;
|
|
}
|
|
value = environment.__proto__.__proto__;
|
|
const value3 = env2_10(a0);
|
|
let binding = env2_0;
|
|
const HTTP = binding(env2_2[7]).HTTP;
|
|
const post = HTTP.post;
|
|
binding = env2_7;
|
|
const GUILD_AUTOMOD_VALIDATE_RULE = binding.GUILD_AUTOMOD_VALIDATE_RULE;
|
|
yield Reflect.apply(post, HTTP, [{url: Reflect.apply(GUILD_AUTOMOD_VALIDATE_RULE, binding, [a0.guildId]),
|
|
body: value3, rejectWithError: false}]);
|
|
const value4 = undefined;
|
|
if (false) {
|
|
return value4;
|
|
}
|
|
value = env2_0(env2_2[4]);
|
|
return value._transformMetadataToCamelCase(value4.body);
|
|
}
|
|
|
|
}
|
|
|
|
function _createAutomodRule() { // fn#87727, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11645:1839, offset: 0x01fc9745, size: 50 bytes, params: 1, frame: 14
|
|
return Module00005(_fun87729).apply(this, arguments);
|
|
function* _fun87729(a0) { // fn#87729, original name: ?anon_0_, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11645:1898, offset: 0x01fc9782, size: 134 bytes, params: 2, frame: 18
|
|
if (false) {
|
|
return undefined;
|
|
}
|
|
value = environment.__proto__.__proto__;
|
|
const value3 = env2_10(a0);
|
|
delete value3.id;
|
|
const binding = env2_12;
|
|
const HTTP = env2_0(env2_2[7]).HTTP;
|
|
const post = HTTP.post;
|
|
const binding3 = env2_7;
|
|
const GUILD_AUTOMOD_RULES = binding3.GUILD_AUTOMOD_RULES;
|
|
yield Reflect.apply(post, HTTP, [{url: Reflect.apply(GUILD_AUTOMOD_RULES, binding3, [a0.guildId]), body: value3,
|
|
rejectWithError: false}]);
|
|
value = undefined;
|
|
if (false) {
|
|
return value;
|
|
}
|
|
return binding(value.body);
|
|
}
|
|
|
|
}
|
|
|
|
function _updateAutomodRule() { // fn#87730, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11645:2123, offset: 0x01fc9808, size: 50 bytes, params: 1, frame: 14
|
|
return Module00005(_fun87732).apply(this, arguments);
|
|
function* _fun87732(a0) { // fn#87732, original name: ?anon_0_, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11645:2182, offset: 0x01fc9845, size: 138 bytes, params: 2, frame: 20
|
|
if (false) {
|
|
return undefined;
|
|
}
|
|
value = environment.__proto__.__proto__;
|
|
const value3 = env2_10(a0);
|
|
const binding = env2_12;
|
|
const HTTP = env2_0(env2_2[7]).HTTP;
|
|
const patch = HTTP.patch;
|
|
const binding3 = env2_7;
|
|
const GUILD_AUTOMOD_RULE = binding3.GUILD_AUTOMOD_RULE;
|
|
yield Reflect.apply(patch, HTTP, [{url: Reflect.apply(GUILD_AUTOMOD_RULE, binding3, [a0.guildId, a0.id]),
|
|
body: value3, rejectWithError: false}]);
|
|
value = undefined;
|
|
if (false) {
|
|
return value;
|
|
}
|
|
return binding(value.body);
|
|
}
|
|
|
|
}
|
|
|
|
function _deleteAutomodRule() { // fn#87733, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11645:2400, offset: 0x01fc98cf, size: 50 bytes, params: 1, frame: 14
|
|
return Module00005(_fun87735).apply(this, arguments);
|
|
function* _fun87735(a0, a1) { // fn#87735, original name: ?anon_0_, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11645:2459, offset: 0x01fc990c, size: 103 bytes, params: 3, frame: 17
|
|
if (false) {
|
|
return undefined;
|
|
}
|
|
value = environment.__proto__.__proto__;
|
|
const HTTP = env2_0(env2_2[7]).HTTP;
|
|
const del = HTTP.del;
|
|
const object = {};
|
|
object.url = env2_7.GUILD_AUTOMOD_RULE(a1, a0);
|
|
object.rejectWithError = false;
|
|
yield Reflect.apply(del, HTTP, [object]);
|
|
if (false) {
|
|
return undefined;
|
|
}
|
|
return true;
|
|
}
|
|
|
|
}
|
|
|
|
function _fetchAutomodRules() { // fn#87736, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11645:2585, offset: 0x01fc9973, size: 50 bytes, params: 1, frame: 14
|
|
return Module00005(_fun87738).apply(this, arguments);
|
|
function* _fun87738(a0) { // fn#87738, original name: ?anon_0_, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11645:2644, offset: 0x01fc99b0, size: 150 bytes, params: 2, frame: 16
|
|
if (false) {
|
|
return undefined;
|
|
}
|
|
value = environment.__proto__.__proto__;
|
|
const HTTP = env2_0(env2_2[7]).HTTP;
|
|
const get = HTTP.get;
|
|
const object = {};
|
|
object.url = env2_7.GUILD_AUTOMOD_RULES(a0);
|
|
object.rejectWithError = false;
|
|
yield Reflect.apply(get, HTTP, [object]);
|
|
const value3 = undefined;
|
|
if (false) {
|
|
return value3;
|
|
}
|
|
const Array = global.Array;
|
|
return Array.isArray(value3.body) ? value3.body.map(env2_12) : [];
|
|
}
|
|
|
|
}
|
|
|
|
function _executeAlertAction() { // fn#87739, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11645:2837, offset: 0x01fc9a46, size: 50 bytes, params: 1, frame: 14
|
|
return Module00005(_fun87741).apply(this, arguments);
|
|
function* _fun87741(a0, a1, a2) { // fn#87741, original name: ?anon_0_, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11645:2898, offset: 0x01fc9a83, size: 169 bytes, params: 4, frame: 17
|
|
var HTTP;
|
|
var post;
|
|
if (true) {
|
|
value = environment.__proto__.__proto__;
|
|
var binding = env2_5;
|
|
var can = binding.can;
|
|
var MANAGE_MESSAGES = env2_8.MANAGE_MESSAGES;
|
|
if (Reflect.apply(can, binding, [MANAGE_MESSAGES, a1])) {
|
|
binding = env2_0;
|
|
HTTP = binding(env2_2[7]).HTTP;
|
|
post = HTTP.post;
|
|
binding = env2_7;
|
|
yield Reflect.apply(post, HTTP, [{url: binding.GUILD_AUTOMOD_ALERT_ACTION(a1.guild_id),
|
|
body: {message_id: a0,
|
|
channel_id: a1.id, alert_action_type: a2}, rejectWithError: false}]);
|
|
if (false) {
|
|
return undefined;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
function removeMentionRaidRestrictionWithFeedback(a0, a1, a2) { // fn#87748, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11645:3845, offset: 0x01fc9b2c, size: 123 bytes, params: 4, frame: 16
|
|
const env0_0 = a0;
|
|
const env0_1 = a1;
|
|
const env0_2 = a2;
|
|
const guild = GuildStore.getGuild(a0);
|
|
if (guild != null && PermissionStore.can(Permissions.MANAGE_GUILD, guild)) {
|
|
(require(11453) /* metro dependency 11453: GuildAutomodActionActionCreatorsNative */).openConfirmRemoveMentionRaid(_fun87749);
|
|
}
|
|
function _fun87749() { // fn#87749, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11645:3994, offset: 0x01fc9ba7, size: 159 bytes, params: 1, frame: 19
|
|
const trackWithMetadata = AppAnalyticsUtilsModule.trackWithMetadata;
|
|
const GUILD_AUTOMOD_FEEDBACK = AnalyticEvents.GUILD_AUTOMOD_FEEDBACK;
|
|
const Feedback = (AutomodFeedbackModule).Feedback;
|
|
const MENTION_RAID_REMOVE_RESTRICTION = Feedback.MENTION_RAID_REMOVE_RESTRICTION;
|
|
Reflect.apply(trackWithMetadata, AppAnalyticsUtilsModule, [GUILD_AUTOMOD_FEEDBACK,
|
|
{feedback_type: MENTION_RAID_REMOVE_RESTRICTION, decision_id: require}]);
|
|
const HTTP = (HTTPUtilsModule).HTTP;
|
|
const post = HTTP.post;
|
|
object = {};
|
|
object.url = Endpoints.GUILD_AUTOMOD_CLEAR_MENTION_RAID(env0_0);
|
|
object.rejectWithError = true;
|
|
Reflect.apply(post, HTTP, [object]);
|
|
importDefault();
|
|
}
|
|
|
|
}
|
|
|
|
function clearMentionRaidDetected(a0) { // fn#87750, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11645:4248, offset: 0x01fc9c46, size: 56 bytes, params: 2, frame: 13
|
|
(Dispatcher).dispatch({type: 'AUTO_MODERATION_MENTION_RAID_NOTICE_DISMISS',
|
|
guildId: a0});
|
|
}
|
|
|
|
}
|
|
|
|
global.__d(_fun87719, 11459, [5, 1867, 3784, 661, 11460, 1360, 21, 507, 11453, 4863, 5061, 694,
|
|
2]) /* metro module 11459, dependencies: [5, 1867, 3784, 661, 11460, 1360, 21, 507, 11453, 4863, 5061, 694, 2] */;
|