Files
discord-decomp/sources/modules/guild_antiraid/GuildAntiRaidPermissionsUtils.tsx
T
2026-07-28 01:06:53 +03:00

104 lines
6.3 KiB
TypeScript

/* Metro module 10924; source: modules/guild_antiraid/GuildAntiRaidPermissionsUtils.tsx; dependencies: [3784, 10906, 661, 566, 8275, 10925, 2] */
import PermissionStore from '../../stores/PermissionStore.tsx'; /* Metro dependency 3784 */
import GuildIncidentsStore from './GuildIncidentsStore.tsx'; /* Metro dependency 10906 */
import * as FileImportTrackerModule from '../../by-id/module-00002-FileImportTracker.js'; /* Metro dependency 2 */
import * as FluxModule from '../../external/discord_common/js/packages/flux/index.tsx'; /* Metro dependency 566 */
import * as ConstantsModule from '../../Constants.tsx'; /* Metro dependency 661 */
import * as ExperimentUtilsModule from '../guild_automod/ExperimentUtils.tsx'; /* Metro dependency 10925 */
function _fun83722(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#83722, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11110:6, offset: 0x01f25ff4, size: 228 bytes, params: 8, frame: 21
let env0_0 = require;
const canReportRaid2 = canReportRaid;
const canEnableRaidAlerts2 = canEnableRaidAlerts;
const Object = global.Object;
Object.defineProperty(exports, '__esModule', {value: true});
(FileImportTrackerModule).fileFinishedImporting('modules/guild_antiraid/GuildAntiRaidPermissionsUtils.tsx');
exports.canReportRaid = canReportRaid2;
exports.useCanReportRaid = useCanReportRaid;
exports.canEnableRaidAlerts = canEnableRaidAlerts2;
exports.useCanEnableRaidAlerts = function(a0) {
var env0_0 = a0;
return require(dependencyMap[3]).useStateFromStores([PermissionStore], _fun83729, [a0]);
};
exports.useShowMentionRaidLimitUpsell = useShowMentionRaidLimitUpsell;
function canReportRaid(a0) { // fn#83723, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11110:172, offset: 0x01f260d8, size: 124 bytes, params: 2, frame: 15
const value = a1;
const r2 = value !== undefined ? value : PermissionStore;
const can = r2.can;
const BAN_MEMBERS = Permissions.BAN_MEMBERS;
let r0 = Reflect.apply(can, r2, [BAN_MEMBERS, a0]) || r2.can(Permissions.KICK_MEMBERS, a0);
r0 = !r0 ? r2.can(Permissions.MODERATE_MEMBERS, a0) : r0;
r0 = !r0 ? r2.can(Permissions.MANAGE_GUILD, a0) : r0;
return r0;
}
function canEnableRaidAlerts(a0) { // fn#83724, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11110:311, offset: 0x01f26154, size: 46 bytes, params: 2, frame: 13
const value = a1;
const r3 = value !== undefined ? value : PermissionStore;
const can = r3.can;
const MANAGE_GUILD = Permissions.MANAGE_GUILD;
return Reflect.apply(can, r3, [MANAGE_GUILD, a0]);
}
function useCanReportRaid(a0) { // fn#83725, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11110:517, offset: 0x01f26182, size: 172 bytes, params: 2, frame: 22
var r0;
const env0_0 = a0;
var value;
const value2 = (FluxModule).useStateFromStores([PermissionStore], _fun83726,
[a0]);
const value3 = (FluxModule).useStateFromStores([GuildIncidentsStore], _fun83727,
[a0]);
const value4 = value3 != null;
if (value4) {
value = require(8275) /* metro dependency 8275: GuildAntiRaidUtils */;
value = value.hasDetectedActivity(value3);
r0 = value;
} else {
r0 = value4;
}
r0 = !r0 && value2;
return r0;
function _fun83726() { // fn#83726, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11110:584, offset: 0x01f2622e, size: 28 bytes, params: 1, frame: 13
return canReportRaid(env0_0, PermissionStore);
}
function _fun83727() { // fn#83727, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11110:647, offset: 0x01f2624a, size: 45 bytes, params: 1, frame: 12
const value2 = null;
return value2 != env0_0 ? GuildIncidentsStore.getGuildIncident(env0_0.id) : value2;
}
}
function useCanEnableRaidAlerts(a0) { // fn#83728, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11110:815, offset: 0x01f26277, size: 75 bytes, params: 2, frame: 16
const env0_0 = a0;
return (FluxModule).useStateFromStores([PermissionStore], _fun83729, [a0]);
function _fun83729() { // fn#83729, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11110:889, offset: 0x01f262c2, size: 28 bytes, params: 1, frame: 13
return canEnableRaidAlerts(env0_0, PermissionStore);
}
}
function useShowMentionRaidLimitUpsell(a0) { // fn#83730, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11110:957, offset: 0x01f262de, size: 129 bytes, params: 2, frame: 21
const env0_0 = a0;
const value2 = undefined;
const value3 = (FluxModule).useStateFromStores([PermissionStore], _fun83731,
[a0]);
const useIsMentionRaidExperimentEnabled = ExperimentUtilsModule.useIsMentionRaidExperimentEnabled;
return Reflect.apply(useIsMentionRaidExperimentEnabled, ExperimentUtilsModule,
[(a0 == null ? value2 : a0.id) ?? EMPTY_STRING_SNOWFLAKE_ID, false]) && value3;
function _fun83731() { // fn#83731, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11110:1039, offset: 0x01f2635f, size: 48 bytes, params: 1, frame: 13
const binding = env0_0;
const permissionStoreBinding = PermissionStore;
const permissionStore2 = permissionStoreBinding !== undefined ? permissionStoreBinding : PermissionStore;
const can = permissionStore2.can;
const MANAGE_GUILD = Permissions.MANAGE_GUILD;
return Reflect.apply(can, permissionStore2, [MANAGE_GUILD, binding]);
}
}
}
global.__d(_fun83722, 10924, [3784, 10906, 661, 566, 8275, 10925,
2]) /* metro module 10924, dependencies: [3784, 10906, 661, 566, 8275, 10925, 2] */;