decord/source/utils/ReportUtils.tsx

136 lines
3.8 KiB
TypeScript
Raw Normal View History

2026-09-03 10:05:34 +00:00
// Module ID: 6144
// Function ID: 6145
2026-07-20 16:05:17 +00:00
// Name: canReportUser
2026-09-02 09:53:35 +00:00
// Dependencies: [1386, 4398, 4120, 1921, 673, 2]
2026-07-29 08:29:29 +00:00
// Exports: canDeleteAndReportMessage, canReportAndDeleteInChannel, canReportMessage, canReportUser
2026-07-20 16:05:17 +00:00
2026-09-03 10:05:34 +00:00
// Module 6144 (canReportUser)
2026-09-02 09:53:35 +00:00
import closure_0 from "ensureGuildLoaded" /* 1386 */;
2026-09-01 10:26:29 +00:00
import closure_1 from "handleInviteData" /* 4398 */;
2026-09-02 09:53:35 +00:00
import closure_2 from "getUncachedChannelPermissions" /* 4120 */;
import closure_3 from "mergeGuildAvatar" /* 1921 */;
import ME from "ME" /* 673 */;
2026-07-23 10:11:24 +00:00
2026-08-24 06:08:38 +00:00
({ ChannelTypes: c4, Permissions: c5, MessageTypesSets: closure_6 } = ME);
const result = require("set").fileFinishedImporting("utils/ReportUtils.tsx");
2026-07-29 08:29:29 +00:00
export const canReportUser = function canReportUser(user) {
if (null == user) {
2026-07-20 16:05:17 +00:00
return false;
} else {
2026-07-29 08:29:29 +00:00
const currentUser = authStore.getCurrentUser();
2026-07-20 16:05:17 +00:00
let tmp3 = null != currentUser;
if (tmp3) {
2026-07-29 08:29:29 +00:00
let tmp4 = currentUser.id !== user.id;
2026-07-20 16:05:17 +00:00
if (tmp4) {
2026-07-29 08:29:29 +00:00
tmp4 = true !== user.system;
2026-07-20 16:05:17 +00:00
}
tmp3 = tmp4;
}
return tmp3;
}
2026-07-29 08:29:29 +00:00
};
export const canReportMessage = function canReportMessage(message) {
2026-07-20 16:05:17 +00:00
let tmp = null != message;
2026-08-24 06:08:38 +00:00
if (tmp) {
const NON_REPORTABLE = constants3.NON_REPORTABLE;
tmp = !NON_REPORTABLE.has(message.type);
}
2026-07-20 16:05:17 +00:00
if (tmp) {
2026-07-29 08:29:29 +00:00
const author = message.author;
let flag = false;
if (null != author) {
const currentUser = authStore.getCurrentUser();
2026-08-24 06:08:38 +00:00
let tmp5 = null != currentUser;
if (tmp5) {
let tmp6 = currentUser.id !== author.id;
if (tmp6) {
tmp6 = true !== author.system;
2026-07-29 08:29:29 +00:00
}
2026-08-24 06:08:38 +00:00
tmp5 = tmp6;
2026-07-29 08:29:29 +00:00
}
2026-08-24 06:08:38 +00:00
flag = tmp5;
2026-07-29 08:29:29 +00:00
}
tmp = flag;
2026-07-20 16:05:17 +00:00
}
return tmp;
2026-07-29 08:29:29 +00:00
};
export const canReportAndDeleteInChannel = function canReportAndDeleteInChannel(arg0) {
const channel = store.getChannel(arg0);
2026-07-20 16:05:17 +00:00
if (null == channel) {
return false;
} else {
if (channel.type !== constants.DM) {
2026-07-29 08:29:29 +00:00
if (channel.type !== tmp6.GROUP_DM) {
const obj = { channelId: null };
obj[0] = arg0;
2026-08-24 06:08:38 +00:00
if (closure_2.canWithPartialContext(constants2.MANAGE_MESSAGES, obj)) {
2026-07-29 08:29:29 +00:00
const memberCount = store2.getMemberCount(channel.getGuildId());
let tmp5 = null != memberCount;
if (tmp5) {
tmp5 = memberCount >= 50;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
return tmp5;
2026-07-20 16:05:17 +00:00
} else {
return false;
}
}
}
return true;
}
2026-07-29 08:29:29 +00:00
};
2026-08-24 06:08:38 +00:00
export const canDeleteAndReportMessage = function canDeleteAndReportMessage(type) {
let tmp = null != type;
2026-07-20 16:05:17 +00:00
if (tmp) {
2026-08-24 06:08:38 +00:00
let tmp2 = null != type;
if (tmp2) {
const NON_REPORTABLE = constants3.NON_REPORTABLE;
tmp2 = !NON_REPORTABLE.has(type.type);
}
2026-07-29 08:29:29 +00:00
if (tmp2) {
2026-08-24 06:08:38 +00:00
const author = type.author;
2026-07-29 08:29:29 +00:00
let flag = false;
if (null != author) {
const currentUser = authStore.getCurrentUser();
2026-08-24 06:08:38 +00:00
let tmp6 = null != currentUser;
if (tmp6) {
let tmp7 = currentUser.id !== author.id;
if (tmp7) {
tmp7 = true !== author.system;
2026-07-29 08:29:29 +00:00
}
2026-08-24 06:08:38 +00:00
tmp6 = tmp7;
2026-07-29 08:29:29 +00:00
}
2026-08-24 06:08:38 +00:00
flag = tmp6;
2026-07-29 08:29:29 +00:00
}
tmp2 = flag;
}
tmp = tmp2;
2026-07-20 16:05:17 +00:00
}
if (tmp) {
2026-08-24 06:08:38 +00:00
const channelId = type.getChannelId();
2026-07-29 08:29:29 +00:00
const channel = store.getChannel(channelId);
let flag3 = false;
if (null != channel) {
flag3 = true;
if (channel.type !== constants.DM) {
flag3 = true;
2026-08-24 06:08:38 +00:00
if (channel.type !== tmp10.GROUP_DM) {
2026-07-29 08:29:29 +00:00
const obj = { channelId: null };
obj[0] = channelId;
flag3 = false;
2026-08-24 06:08:38 +00:00
if (closure_2.canWithPartialContext(constants2.MANAGE_MESSAGES, obj)) {
2026-07-29 08:29:29 +00:00
const memberCount = store2.getMemberCount(channel.getGuildId());
2026-08-24 06:08:38 +00:00
let tmp15 = null != memberCount;
if (tmp15) {
tmp15 = memberCount >= 50;
2026-07-29 08:29:29 +00:00
}
2026-08-24 06:08:38 +00:00
flag3 = tmp15;
2026-07-29 08:29:29 +00:00
}
}
}
}
tmp = flag3;
2026-07-20 16:05:17 +00:00
}
return tmp;
};