320 lines
8.7 KiB
TypeScript
320 lines
8.7 KiB
TypeScript
// Module ID: 17012
|
|
// Function ID: 17013
|
|
// Name: guild_automod/PermissionUtils
|
|
// Dependencies: [2074, 4509, 11474, 1085, 558, 576, 504, 2]
|
|
// Exports: canCurrentUserManageAutomod, canCurrentUserManageMessageFilters, hasMentionRaidLimitAccess
|
|
|
|
// Module 17012 (guild_automod/PermissionUtils)
|
|
import Constants2 from "Constants" /* 11474 */;
|
|
import GuildStore from "GuildStore" /* 2074 */;
|
|
import PermissionStore from "PermissionStore" /* 4509 */;
|
|
import Constants from "Constants" /* 1085 */;
|
|
import ReactCompilerGating_mod from "ReactCompilerGating" /* 558 */;
|
|
import size from "module_2" /* 2 */;
|
|
|
|
const require = globalThis.__r;
|
|
let _require, dependencyMap;
|
|
|
|
let hasOwnProperty;
|
|
let metroRequire;
|
|
const AutomodTriggerType = Constants2.AutomodTriggerType;
|
|
({ GuildFeatures: hasOwnProperty, Permissions: metroRequire } = Constants);
|
|
let ReactCompilerGating = ReactCompilerGating_mod;
|
|
const tmp3 = ReactCompilerGating.isReactCompilerEnabled() ? ((arg0) => {
|
|
let closure_0;
|
|
let first;
|
|
let tmp7;
|
|
let tmp8;
|
|
_require = arg0;
|
|
const tmp = _require;
|
|
let obj = require("react");
|
|
const cResult = obj.c(4);
|
|
if (cResult[0] === Symbol.for("react.memo_cache_sentinel")) {
|
|
const items = [GuildStore, PermissionStore];
|
|
cResult[0] = items;
|
|
first = items;
|
|
} else {
|
|
first = cResult[0];
|
|
}
|
|
if (cResult[1] !== arg0) {
|
|
const fn = function o() {
|
|
const obj = GuildStore;
|
|
if (GuildStore !== undefined) {
|
|
if (PermissionStore !== undefined) {
|
|
const guild = obj.getGuild(tmp);
|
|
const canResult = null != guild && obj2.can(metroRequire.MANAGE_GUILD, guild);
|
|
return canResult;
|
|
}
|
|
}
|
|
};
|
|
const items1 = [arg0];
|
|
cResult[1] = arg0;
|
|
cResult[2] = fn;
|
|
cResult[3] = items1;
|
|
tmp8 = items1;
|
|
tmp7 = fn;
|
|
} else {
|
|
tmp7 = cResult[2];
|
|
tmp8 = cResult[3];
|
|
}
|
|
const tmpResult = tmp(504);
|
|
return tmpResult.useStateFromStores(first, tmp7, tmp8);
|
|
}) : ((arg0) => {
|
|
let closure_0;
|
|
_require = arg0;
|
|
let obj = require("get initialized");
|
|
const items = [GuildStore, PermissionStore];
|
|
const items1 = [arg0];
|
|
return obj.useStateFromStores(items, () => {
|
|
const obj = GuildStore;
|
|
if (GuildStore !== undefined) {
|
|
if (PermissionStore !== undefined) {
|
|
const guild = obj.getGuild(tmp);
|
|
const canResult = null != guild && obj2.can(metroRequire.MANAGE_GUILD, guild);
|
|
return canResult;
|
|
}
|
|
}
|
|
}, items1);
|
|
});
|
|
ReactCompilerGating = ReactCompilerGating_mod;
|
|
const tmp4 = ReactCompilerGating.isReactCompilerEnabled() ? ((arg0) => {
|
|
let closure_0;
|
|
let first;
|
|
let tmp6;
|
|
let tmp7;
|
|
_require = arg0;
|
|
const tmp = _require;
|
|
let obj = require("react");
|
|
const cResult = obj.c(4);
|
|
if (cResult[0] === Symbol.for("react.memo_cache_sentinel")) {
|
|
const items = [GuildStore];
|
|
cResult[0] = items;
|
|
first = items;
|
|
} else {
|
|
first = cResult[0];
|
|
}
|
|
if (cResult[1] !== arg0) {
|
|
const fn = function u() {
|
|
const obj = GuildStore;
|
|
if (GuildStore !== undefined) {
|
|
const guild = obj.getGuild(tmp);
|
|
let flag;
|
|
if (guild != null) {
|
|
const features = guild.features;
|
|
flag = features.has(hasOwnProperty.COMMUNITY);
|
|
}
|
|
if (flag == null) {
|
|
flag = false;
|
|
}
|
|
return flag;
|
|
}
|
|
};
|
|
const items1 = [arg0];
|
|
cResult[1] = arg0;
|
|
cResult[2] = fn;
|
|
cResult[3] = items1;
|
|
tmp7 = items1;
|
|
tmp6 = fn;
|
|
} else {
|
|
tmp6 = cResult[2];
|
|
tmp7 = cResult[3];
|
|
}
|
|
const tmpResult = tmp(504);
|
|
return tmpResult.useStateFromStores(first, tmp6, tmp7);
|
|
}) : ((arg0) => {
|
|
let closure_0;
|
|
_require = arg0;
|
|
let obj = require("get initialized");
|
|
const items = [GuildStore];
|
|
const items1 = [arg0];
|
|
return obj.useStateFromStores(items, () => {
|
|
const obj = GuildStore;
|
|
if (GuildStore !== undefined) {
|
|
const guild = obj.getGuild(tmp);
|
|
let flag;
|
|
if (guild != null) {
|
|
const features = guild.features;
|
|
flag = features.has(hasOwnProperty.COMMUNITY);
|
|
}
|
|
if (flag == null) {
|
|
flag = false;
|
|
}
|
|
return flag;
|
|
}
|
|
}, items1);
|
|
});
|
|
ReactCompilerGating = ReactCompilerGating_mod;
|
|
const tmp5 = ReactCompilerGating.isReactCompilerEnabled() ? ((arg0, arg1) => {
|
|
let closure_0;
|
|
let closure_1;
|
|
let first;
|
|
_require = arg0;
|
|
dependencyMap = arg1;
|
|
const obj = require("react");
|
|
const cResult = obj.c(5);
|
|
const tmp = _require;
|
|
if (cResult[0] === Symbol.for("react.memo_cache_sentinel")) {
|
|
const items = [GuildStore];
|
|
cResult[0] = items;
|
|
first = items;
|
|
} else {
|
|
first = cResult[0];
|
|
}
|
|
if (cResult[1] === arg0) {
|
|
let tmp6;
|
|
let tmp7;
|
|
if (cResult[2] === arg1) {
|
|
tmp6 = cResult[3];
|
|
tmp7 = cResult[4];
|
|
}
|
|
const tmpResult = tmp(504);
|
|
return tmpResult.useStateFromStores(first, tmp6, tmp7);
|
|
}
|
|
const fn = function l() {
|
|
if (closure_1 !== AutomodTriggerType.MENTION_SPAM) {
|
|
return false;
|
|
} else {
|
|
const guild = GuildStore.getGuild(closure_0);
|
|
let hasItem = null != guild;
|
|
if (hasItem) {
|
|
const features = guild.features;
|
|
hasItem = features.has(hasOwnProperty.COMMUNITY);
|
|
}
|
|
return hasItem;
|
|
}
|
|
};
|
|
const items1 = [arg0, arg1];
|
|
cResult[1] = arg0;
|
|
cResult[2] = arg1;
|
|
cResult[3] = fn;
|
|
cResult[4] = items1;
|
|
tmp7 = items1;
|
|
tmp6 = fn;
|
|
}) : ((arg0, arg1) => {
|
|
let closure_0;
|
|
let closure_1;
|
|
_require = arg0;
|
|
dependencyMap = arg1;
|
|
const items = [GuildStore];
|
|
const items1 = [arg0, arg1];
|
|
const obj = require("get initialized");
|
|
return obj.useStateFromStores(items, () => {
|
|
if (closure_1 !== AutomodTriggerType.MENTION_SPAM) {
|
|
return false;
|
|
} else {
|
|
const guild = GuildStore.getGuild(closure_0);
|
|
let hasItem = null != guild;
|
|
if (hasItem) {
|
|
const features = guild.features;
|
|
hasItem = features.has(hasOwnProperty.COMMUNITY);
|
|
}
|
|
return hasItem;
|
|
}
|
|
}, items1);
|
|
});
|
|
ReactCompilerGating = ReactCompilerGating_mod;
|
|
let tmp6 = ReactCompilerGating.isReactCompilerEnabled() ? ((arg0) => {
|
|
let closure_0;
|
|
let first;
|
|
let tmp6;
|
|
let tmp7;
|
|
_require = arg0;
|
|
const obj = require("react");
|
|
const cResult = obj.c(4);
|
|
const tmp = _require;
|
|
if (cResult[0] === Symbol.for("react.memo_cache_sentinel")) {
|
|
const items = [GuildStore];
|
|
cResult[0] = items;
|
|
first = items;
|
|
} else {
|
|
first = cResult[0];
|
|
}
|
|
if (cResult[1] !== arg0) {
|
|
const fn = function u() {
|
|
const guild = GuildStore.getGuild(closure_0);
|
|
let flag;
|
|
if (guild != null) {
|
|
const features = guild.features;
|
|
flag = features.has(hasOwnProperty.COMMUNITY);
|
|
}
|
|
if (!flag) {
|
|
flag = false;
|
|
}
|
|
return flag;
|
|
};
|
|
const items1 = [arg0];
|
|
cResult[1] = arg0;
|
|
cResult[2] = fn;
|
|
cResult[3] = items1;
|
|
tmp7 = items1;
|
|
tmp6 = fn;
|
|
} else {
|
|
tmp6 = cResult[2];
|
|
tmp7 = cResult[3];
|
|
}
|
|
const tmpResult = tmp(504);
|
|
return tmpResult.useStateFromStores(first, tmp6, tmp7);
|
|
}) : ((arg0) => {
|
|
let closure_0;
|
|
_require = arg0;
|
|
const items = [GuildStore];
|
|
const items1 = [arg0];
|
|
const obj = require("get initialized");
|
|
return obj.useStateFromStores(items, () => {
|
|
const guild = GuildStore.getGuild(closure_0);
|
|
let flag;
|
|
if (guild != null) {
|
|
const features = guild.features;
|
|
flag = features.has(hasOwnProperty.COMMUNITY);
|
|
}
|
|
if (!flag) {
|
|
flag = false;
|
|
}
|
|
return flag;
|
|
}, items1);
|
|
});
|
|
function hasMentionRaidLimitAccess(guildId) {
|
|
let obj = arg1;
|
|
if (arg1 === undefined) {
|
|
obj = GuildStore;
|
|
}
|
|
const guild = obj.getGuild(guildId);
|
|
let flag;
|
|
if (guild != null) {
|
|
const features = guild.features;
|
|
flag = features.has(hasOwnProperty.COMMUNITY);
|
|
}
|
|
if (flag == null) {
|
|
flag = false;
|
|
}
|
|
return flag;
|
|
}
|
|
const result = size.fileFinishedImporting("modules/guild_automod/PermissionUtils.tsx");
|
|
|
|
export const canCurrentUserManageMessageFilters = function canCurrentUserManageMessageFilters(guild_id) {
|
|
let tmp = null != guild_id;
|
|
if (tmp) {
|
|
const guild = GuildStore.getGuild(guild_id);
|
|
let canResult = null != guild;
|
|
const obj = PermissionStore;
|
|
if (canResult) {
|
|
canResult = obj.can(metroRequire.MANAGE_GUILD, guild);
|
|
}
|
|
tmp = canResult;
|
|
}
|
|
return tmp;
|
|
};
|
|
export const canCurrentUserManageAutomod = function canCurrentUserManageAutomod(arg0) {
|
|
const guild = GuildStore.getGuild(arg0);
|
|
let canResult = null != guild;
|
|
const obj = PermissionStore;
|
|
if (canResult) {
|
|
canResult = obj.can(metroRequire.MANAGE_GUILD, guild);
|
|
}
|
|
return canResult;
|
|
};
|
|
export const useCanCurrentUserManageAutomod = tmp3;
|
|
export { hasMentionRaidLimitAccess };
|
|
export const useHasMentionRaidLimitAccess = tmp4;
|
|
export const useIsUndeletableMentionSpamRule = tmp5;
|
|
export const useIsUserProfileRuleEnabled = tmp6;
|