decord/stable/source/modules/replies/canReplyToMessage.tsx
github-actions 57c2214117 chore: update source for stable 347.12
Skipped 1 file(s) >100MB (GitHub limit): source/__polyfill/04xxx/module_4973.js (118.4 MB)
2026-09-29 21:26:22 +00:00

116 lines
3.7 KiB
TypeScript

// Module ID: 8266
// Function ID: 8267
// Name: canReplyToMessage
// Dependencies: [32, 4427, 1372, 1074, 1085, 1090, 7543, 8267, 504, 2]
// Exports: canReplyToMessage, useCanReplyToMessage
// Module 8266 (canReplyToMessage)
import MessageTypes from "MessageTypes" /* 1090 */;
import ThreadHooks from "ThreadHooks" /* 7543 */;
import useUserCommunicationDisabled from "useUserCommunicationDisabled" /* 8267 */;
import _slicedToArray from "module_32" /* 32 */;
import PermissionStore from "PermissionStore" /* 4427 */;
import UserStore from "UserStore" /* 1372 */;
const require = globalThis.__r;
require = fn;
const Constants = fn(1074);
({ MessageFlags: hasOwnProperty, MessageStates: metroRequire } = Constants);
const Permissions = fn(1085).Permissions;
const size = fn(2);
const result = size.fileFinishedImporting("modules/replies/canReplyToMessage.tsx");
export const useCanReplyToMessage = function useCanReplyToMessage(channel, message) {
_require = channel;
dependencyMap = message;
const canUnarchiveThread = require("ThreadHooks").useCanUnarchiveThread(channel);
const obj = require("ThreadHooks");
let tmp = _require;
let guildId;
if (channel != null) {
guildId = channel.getGuildId();
}
const obj2 = require("useUserCommunicationDisabled");
const items = [PermissionStore];
let stateFromStores = tmp(504).useStateFromStores(items, () => {
let tmp = null != closure_0;
if (tmp) {
tmp = null != closure_1;
}
if (tmp) {
if (obj.isPrivate()) {
let hasItem = !obj.isSystemDM();
} else {
hasItem = obj2.can(Permissions.SEND_MESSAGES, obj) && obj2.can(Permissions.READ_MESSAGE_HISTORY, obj);
}
if (hasItem) {
const REPLYABLE = MessageTypes.MessageTypesSets.REPLYABLE;
hasItem = REPLYABLE.has(tmp3.type);
}
tmp = hasItem;
tmp3 = closure_1;
}
return tmp;
});
let tmp6 = null != channel && null != message;
if (tmp6) {
const isArchivedThreadResult = channel.isArchivedThread();
let tmp11 = !isArchivedThreadResult;
if (isArchivedThreadResult) {
tmp11 = canUnarchiveThread;
}
if (stateFromStores) {
stateFromStores = message.state === constants2.SENT;
}
if (stateFromStores) {
stateFromStores = !hasFlagResult;
}
if (stateFromStores) {
stateFromStores = !_slicedToArray(obj2.useCurrentUserCommunicationDisabled(guildId), 2)[1];
}
if (stateFromStores) {
stateFromStores = tmp11;
}
tmp6 = stateFromStores;
hasFlagResult = message.hasFlag(constants.EPHEMERAL);
}
return tmp6;
};
export const canReplyToMessage = function canReplyToMessage(isPrivate, type) {
if (isPrivate.isPrivate()) {
let hasItem = !isPrivate.isSystemDM();
} else {
hasItem = obj2.can(Permissions.SEND_MESSAGES, isPrivate) && obj2.can(Permissions.READ_MESSAGE_HISTORY, isPrivate);
}
if (hasItem) {
const REPLYABLE = tmp(1090).MessageTypesSets.REPLYABLE;
hasItem = REPLYABLE.has(type.type);
}
const currentUser = UserStore.getCurrentUser();
const canUnarchiveThreadResult = ThreadHooks.canUnarchiveThread(isPrivate);
let id;
if (currentUser != null) {
id = currentUser.id;
}
const guildId = isPrivate.getGuildId();
const tmpResult = useUserCommunicationDisabled;
const isArchivedThreadResult = isPrivate.isArchivedThread();
let tmp11 = !isArchivedThreadResult;
if (isArchivedThreadResult) {
tmp11 = canUnarchiveThreadResult;
}
if (hasItem) {
hasItem = type.state === constants2.SENT;
}
if (hasItem) {
hasItem = !hasFlagResult;
}
if (hasItem) {
hasItem = !_slicedToArray(tmpResult.userCommunicationDisabled(id, guildId), 2)[1];
}
if (hasItem) {
hasItem = tmp11;
}
return hasItem;
};