decord/alpha/source/utils/ReportUtils.tsx

114 lines
3.2 KiB
TypeScript
Raw Normal View History

// Module ID: 6894
// Function ID: 6895
// Name: ReportUtils
// Dependencies: [2044, 4498, 1372, 1074, 2]
2026-07-29 08:29:29 +00:00
// Exports: canDeleteAndReportMessage, canReportAndDeleteInChannel, canReportMessage, canReportUser
2026-07-20 16:05:17 +00:00
// Module 6894 (ReportUtils)
import ChannelStore from "ChannelStore" /* 2044 */;
import PermissionStore from "PermissionStore" /* 4498 */;
import UserStore from "UserStore" /* 1372 */;
2026-07-23 10:11:24 +00:00
const Constants = fn(1074);
({ ChannelTypes: c3, Permissions: closure_4, MessageTypesSets: hasOwnProperty } = Constants);
const size = fn(2);
let result = size.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 {
const currentUser = UserStore.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 = UserStore.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(channelId) {
const channel = ChannelStore.getChannel(channelId);
let tmp2 = null != channel;
if (tmp2) {
let result = channel.type === constants.DM || channel.type === tmp3.GROUP_DM;
if (!result) {
const obj = { channelId };
result = PermissionStore.canWithPartialContext(constants2.MANAGE_MESSAGES, obj);
2026-07-20 16:05:17 +00:00
}
tmp2 = result;
2026-07-20 16:05:17 +00:00
}
return tmp2;
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 = UserStore.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();
const channel = ChannelStore.getChannel(channelId);
let tmp11 = null != channel;
if (tmp11) {
let result = channel.type === constants.DM || channel.type === tmp12.GROUP_DM;
if (!result) {
const obj = { channelId };
result = PermissionStore.canWithPartialContext(constants2.MANAGE_MESSAGES, obj);
2026-07-29 08:29:29 +00:00
}
tmp11 = result;
2026-07-29 08:29:29 +00:00
}
tmp = tmp11;
2026-07-20 16:05:17 +00:00
}
return tmp;
};