decord/source/modules/guild_automod/native/ModerateUserActionSheet.tsx
github-actions a36fe4ec9c chore: update source for alpha 347.0
Skipped 1 file(s) >100MB (GitHub limit): source/__polyfill/04xxx/module_4821.js (118.4 MB)
2026-09-14 20:04:03 +00:00

212 lines
8.8 KiB
TypeScript

// Module ID: 11965
// Function ID: 11966
// Name: ModerateUserActionSheet
// Dependencies: [19, 2021, 1979, 4275, 1371, 1074, 21, 4636, 504, 11966, 9533, 4788, 4603, 7302, 1114, 7483, 4839, 11967, 1896, 11964, 4263, 11984, 11970, 4577, 11986, 9563, 11988, 7253, 7252, 11990, 5768, 2]
// Module 11965 (ModerateUserActionSheet)
import asyncRequireImpl from "asyncRequireImpl" /* 1896 */;
import ModalActionCreatorsDefault from "ModalActionCreators" /* 4839 */;
import useCanToggleCommunicationDisableOnUser from "useCanToggleCommunicationDisableOnUser" /* 9533 */;
import GuildMemberUtils from "GuildMemberUtils" /* 11966 */;
import GuildDisableCommunicationActionCreators from "GuildDisableCommunicationActionCreators" /* 11970 */;
import showKickConfirmModalDefault from "showKickConfirmModal" /* 11986 */;
import showBanConfirmModalDefault from "showBanConfirmModal" /* 11988 */;
import noop from "module_19" /* 19 */;
import GuildMemberStore from "GuildMemberStore" /* 2021 */;
import GuildStore from "GuildStore" /* 1979 */;
import PermissionStore from "PermissionStore" /* 4275 */;
import UserStore from "UserStore" /* 1371 */;
require = fn;
const Permissions = fn(1074).Permissions;
const jsxProd = fn(21);
({ jsx: closure_9, jsxs: c10 } = jsxProd);
const createStyles = fn(4636);
let closure_11 = createStyles.createStyles({ container: { padding: 16, gap: 16 }, memberRoles: { justifyContent: "flex-start" } });
const size = fn(2);
let result = size.fileFinishedImporting("modules/guild_automod/native/ModerateUserActionSheet.tsx");
export default noop.memo((user) => {
user = user.user;
const guild = user.guild;
let stateFromStores;
let hideActionSheet;
c4 = undefined;
const tmp = closure_11();
let items = [c4];
const items1 = [user, guild];
stateFromStores = user(stateFromStores[8]).useStateFromStores(items, () => {
let id;
if (guild != null) {
id = guild.id;
}
return GuildMemberStore.getMember(id, user.id);
}, items1);
let obj = user(stateFromStores[8]);
const tmp5 = null != stateFromStores ? stateFromStores.roles : [];
const items2 = [PermissionStore, UserStore, GuildStore];
const items3 = [user, guild];
const stateFromStoresObject = user(stateFromStores[8]).useStateFromStoresObject(items2, () => {
let canKickMemberResult = null != guild;
if (canKickMemberResult) {
canKickMemberResult = GuildMemberUtils.canKickMember(user, tmp);
}
const obj2 = { canKickUser: canKickMemberResult, canBanUser: null, canChangeNick: null, canManageRoles: null, canModerateMembers: null };
let canBanMemberResult = null != tmp;
if (canBanMemberResult) {
canBanMemberResult = GuildMemberUtils.canBanMember(user, tmp);
}
obj2.canBanUser = canBanMemberResult;
let canManageUserResult = null != tmp;
if (canManageUserResult) {
canManageUserResult = PermissionStore.canManageUser(Permissions.MANAGE_NICKNAMES, user, tmp);
}
obj2.canChangeNick = canManageUserResult;
let canResult = null != tmp;
if (canResult) {
canResult = PermissionStore.can(Permissions.MANAGE_ROLES, tmp);
}
obj2.canManageRoles = canResult;
let result = null != tmp;
if (result) {
const items = [UserStore, GuildStore, PermissionStore];
result = useCanToggleCommunicationDisableOnUser.canToggleCommunicationDisableOnUser(tmp.id, user.id, items);
}
obj2.canModerateMembers = result;
return obj2;
}, items3);
({ canKickUser, canBanUser } = stateFromStoresObject);
if (null != guild) {
if (null != stateFromStores) {
const name = guild(tmp3[11]).getName(guild.id, undefined, user);
hideActionSheet = guild(tmp3[12]).hideActionSheet;
let tmp11 = null != stateFromStores;
if (tmp11) {
let tmp10 = canKickUser;
if (!canKickUser) {
tmp10 = canBanUser;
}
if (!tmp10) {
tmp10 = tmp7;
}
if (!tmp10) {
tmp10 = tmp8;
}
tmp11 = tmp10;
}
if (tmp11) {
tmp11 = !user.isNonUserBot();
}
const items4 = [];
if (tmp11) {
let obj2 = { label: null, icon: null, onPress: null };
const intl = tmp2(tmp3[14]).intl;
obj2.label = intl.string(tmp2(tmp3[14]).t.HxrBOZ);
let obj3 = { IconComponent: tmp2(tmp3[15]).SettingsIcon };
obj2.icon = closure_9(tmp2(tmp3[13]).ActionSheetRow.Icon, obj3);
obj2.onPress = function onPress() {
hideActionSheet();
ModalActionCreatorsDefault.pushLazy(asyncRequireImpl(11967, dependencyMap.paths), {
userId: user.id,
guildId: guild.id,
onClose() {
guild(stateFromStores[16]).pop();
guild(stateFromStores[19])({ guild, user });
},
onRemove() {
guild(stateFromStores[16]).pop();
}
});
};
items4.push(closure_9(tmp2(tmp3[13]).ActionSheetRow, obj2));
}
if (null != stateFromStores) {
if (tmp9) {
let result = tmp2(tmp3[20]).isMemberCommunicationDisabled(stateFromStores);
c4 = result;
let ClockWarningIcon = tmp2(tmp3[14]).intl;
let Icon = ClockWarningIcon.string;
let t = tmp2(tmp3[14]).t;
if (result) {
let IconResult = Icon(t.qXtNtS);
} else {
IconResult = Icon(t.xpsADY);
}
let obj4 = { label: IconResult, icon: null, onPress: null };
Icon = tmp2(tmp3[13]).ActionSheetRow.Icon;
let obj5 = { IconComponent: null };
ClockWarningIcon = tmp2(tmp3[21]).ClockWarningIcon;
obj5.IconComponent = ClockWarningIcon;
obj4.icon = closure_9(Icon, obj5);
obj4.onPress = function onPress() {
hideActionSheet();
const obj = GuildDisableCommunicationActionCreators;
if (c4) {
({ guildId: obj3.guildId, userId: obj3.userId } = stateFromStores);
const result = obj.openEnableCommunication({ guildId: null, userId: null });
const obj5 = { guildId: null, userId: null };
} else {
({ guildId: obj2.guildId, userId: obj2.userId } = stateFromStores);
const result1 = obj.openDisableCommunication({ guildId: null, userId: null });
const obj6 = { guildId: null, userId: null };
}
};
t = items4.push(tmp15(tmp2(tmp3[13]).ActionSheetRow, obj4));
const tmp2Result2 = tmp2(tmp3[20]);
}
}
if (tmp17) {
let obj6 = { label: null, icon: null, variant: "danger", onPress: null };
const intl2 = tmp2(tmp3[14]).intl;
obj6.label = intl2.string(tmp2(tmp3[14]).t["3glT6Z"]);
const obj7 = { IconComponent: tmp2(tmp3[23]).UserMinusIcon };
obj6.icon = closure_9(tmp2(tmp3[13]).ActionSheetRow.Icon, obj7);
obj6.onPress = function onPress() {
showKickConfirmModalDefault({
guildId: guild.id,
userId: user.id,
cancelButtonCallback() {
return guild(stateFromStores[19])({ guild, user });
}
});
};
items4.push(closure_9(tmp2(tmp3[13]).ActionSheetRow, obj6));
}
if (tmp20) {
const obj8 = { label: null, icon: null, variant: "danger", onPress: null };
const intl3 = tmp2(tmp3[14]).intl;
obj8.label = intl3.string(tmp2(tmp3[14]).t["5MBJ5M"]);
const obj9 = { IconComponent: tmp2(tmp3[25]).HammerIcon };
obj8.icon = closure_9(tmp2(tmp3[13]).ActionSheetRow.Icon, obj9);
obj8.onPress = function onPress() {
showBanConfirmModalDefault({
guildId: guild.id,
userId: user.id,
cancelButtonCallback() {
return guild(stateFromStores[19])({ guild, user });
}
});
};
items4.push(closure_9(tmp2(tmp3[13]).ActionSheetRow, obj8));
}
const obj10 = { header: null, bodyStyles: null, children: null };
const obj11 = { title: null };
const intl4 = tmp2(tmp3[14]).intl;
const obj12 = { nick: name };
obj11.title = intl4.formatToPlainString(tmp2(tmp3[14]).t["792QKT"], obj12);
obj10.header = closure_9(tmp2(tmp3[28]).BottomSheetTitleHeader, obj11);
obj10.bodyStyles = tmp.container;
const obj13 = { style: null, guild: null, userRoles: null };
const items5 = [tmp.memberRoles];
obj13.style = items5;
obj13.guild = guild;
obj13.userRoles = tmp5;
const items6 = [closure_9(guild(tmp3[29]), obj13), ];
const obj14 = { hasIcons: true, children: items4.map((children, index) => closure_1_9(hideActionSheet.Fragment, { children }, "action_" + index)) };
items6[1] = closure_9(tmp2(tmp3[30]).TableRowGroup, obj14);
obj10.children = items6;
return closure_10(tmp2(tmp3[27]).BottomSheet, obj10);
}
}
return null;
});