2026-09-28 16:18:32 +00:00
|
|
|
// Module ID: 7418
|
|
|
|
|
// Function ID: 7419
|
2026-09-18 19:45:33 +00:00
|
|
|
// Name: canReplyToMessage
|
2026-09-28 16:18:32 +00:00
|
|
|
// Dependencies: [32, 4469, 1372, 1074, 1085, 1090, 6687, 7419, 504, 2]
|
2026-09-26 17:57:22 +00:00
|
|
|
// Exports: canReplyToMessage, useCanReplyToMessage
|
2026-09-18 19:45:33 +00:00
|
|
|
|
2026-09-28 16:18:32 +00:00
|
|
|
// Module 7418 (canReplyToMessage)
|
2026-10-01 14:13:23 +00:00
|
|
|
import Constants2 from "Constants" /* 1085 */;
|
2026-09-26 17:57:22 +00:00
|
|
|
import MessageTypes from "MessageTypes" /* 1090 */;
|
2026-09-28 16:18:32 +00:00
|
|
|
import ThreadHooks from "ThreadHooks" /* 6687 */;
|
|
|
|
|
import useUserCommunicationDisabled from "useUserCommunicationDisabled" /* 7419 */;
|
2026-10-01 14:13:23 +00:00
|
|
|
import _slicedToArray from "_slicedToArray" /* 32 */;
|
2026-09-28 16:18:32 +00:00
|
|
|
import PermissionStore from "PermissionStore" /* 4469 */;
|
2026-09-26 17:57:22 +00:00
|
|
|
import UserStore from "UserStore" /* 1372 */;
|
2026-10-01 14:13:23 +00:00
|
|
|
import Constants from "Constants" /* 1074 */;
|
|
|
|
|
import size from "module_2" /* 2 */;
|
2026-09-18 19:45:33 +00:00
|
|
|
|
|
|
|
|
const require = globalThis.__r;
|
2026-10-01 14:13:23 +00:00
|
|
|
let _require, dependencyMap;
|
2026-09-18 19:45:33 +00:00
|
|
|
|
2026-10-01 14:13:23 +00:00
|
|
|
let hasOwnProperty;
|
|
|
|
|
let metroRequire;
|
2026-09-18 19:45:33 +00:00
|
|
|
({ MessageFlags: hasOwnProperty, MessageStates: metroRequire } = Constants);
|
2026-10-01 14:13:23 +00:00
|
|
|
const Permissions = Constants2.Permissions;
|
2026-09-18 19:45:33 +00:00
|
|
|
const result = size.fileFinishedImporting("modules/replies/canReplyToMessage.tsx");
|
|
|
|
|
|
2026-09-26 17:57:22 +00:00
|
|
|
export const useCanReplyToMessage = function useCanReplyToMessage(channel, message) {
|
|
|
|
|
_require = channel;
|
|
|
|
|
dependencyMap = message;
|
2026-09-18 19:45:33 +00:00
|
|
|
let tmp = _require;
|
2026-10-01 14:13:23 +00:00
|
|
|
const obj = require("ThreadHooks");
|
|
|
|
|
const canUnarchiveThread = obj.useCanUnarchiveThread(channel);
|
|
|
|
|
const tmp4 = require("useUserCommunicationDisabled");
|
2026-09-18 19:45:33 +00:00
|
|
|
let guildId;
|
2026-10-01 14:13:23 +00:00
|
|
|
const useCurrentUserCommunicationDisabled = tmp4.useCurrentUserCommunicationDisabled;
|
2026-09-26 17:57:22 +00:00
|
|
|
if (channel != null) {
|
|
|
|
|
guildId = channel.getGuildId();
|
2026-09-18 19:45:33 +00:00
|
|
|
}
|
|
|
|
|
const items = [PermissionStore];
|
2026-10-01 14:13:23 +00:00
|
|
|
const tmp6 = _slicedToArray(useCurrentUserCommunicationDisabled(guildId), 2)[1];
|
|
|
|
|
const tmpResult = tmp(504);
|
|
|
|
|
let stateFromStores = tmpResult.useStateFromStores(items, () => {
|
|
|
|
|
let tmp = null != channel && null != message;
|
2026-09-18 19:45:33 +00:00
|
|
|
if (tmp) {
|
2026-10-01 14:13:23 +00:00
|
|
|
let hasItem;
|
|
|
|
|
const tmp3 = message;
|
|
|
|
|
if (channel.isPrivate()) {
|
|
|
|
|
hasItem = !obj.isSystemDM();
|
2026-09-18 19:45:33 +00:00
|
|
|
} 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;
|
|
|
|
|
}
|
|
|
|
|
return tmp;
|
|
|
|
|
});
|
2026-10-01 14:13:23 +00:00
|
|
|
let tmp8 = null != channel && null != message;
|
|
|
|
|
if (tmp8) {
|
|
|
|
|
const state = message.state;
|
|
|
|
|
const SENT = constants2.SENT;
|
|
|
|
|
const hasFlagResult = message.hasFlag(constants.EPHEMERAL);
|
2026-09-26 17:57:22 +00:00
|
|
|
const isArchivedThreadResult = channel.isArchivedThread();
|
2026-10-01 14:13:23 +00:00
|
|
|
let tmp13 = !isArchivedThreadResult;
|
2026-09-18 19:45:33 +00:00
|
|
|
if (isArchivedThreadResult) {
|
2026-10-01 14:13:23 +00:00
|
|
|
tmp13 = canUnarchiveThread;
|
2026-09-18 19:45:33 +00:00
|
|
|
}
|
|
|
|
|
if (stateFromStores) {
|
2026-10-01 14:13:23 +00:00
|
|
|
stateFromStores = state === SENT;
|
2026-09-18 19:45:33 +00:00
|
|
|
}
|
|
|
|
|
if (stateFromStores) {
|
|
|
|
|
stateFromStores = !hasFlagResult;
|
|
|
|
|
}
|
|
|
|
|
if (stateFromStores) {
|
2026-10-01 14:13:23 +00:00
|
|
|
stateFromStores = !tmp6;
|
2026-09-18 19:45:33 +00:00
|
|
|
}
|
|
|
|
|
if (stateFromStores) {
|
2026-10-01 14:13:23 +00:00
|
|
|
stateFromStores = tmp13;
|
2026-09-18 19:45:33 +00:00
|
|
|
}
|
2026-10-01 14:13:23 +00:00
|
|
|
tmp8 = stateFromStores;
|
2026-09-18 19:45:33 +00:00
|
|
|
}
|
2026-10-01 14:13:23 +00:00
|
|
|
return tmp8;
|
2026-09-26 17:57:22 +00:00
|
|
|
};
|
2026-09-18 19:45:33 +00:00
|
|
|
export const canReplyToMessage = function canReplyToMessage(isPrivate, type) {
|
2026-10-01 14:13:23 +00:00
|
|
|
let hasItem;
|
|
|
|
|
const obj = ThreadHooks;
|
|
|
|
|
const canUnarchiveThreadResult = obj.canUnarchiveThread(isPrivate);
|
2026-09-18 19:45:33 +00:00
|
|
|
if (isPrivate.isPrivate()) {
|
2026-10-01 14:13:23 +00:00
|
|
|
hasItem = !isPrivate.isSystemDM();
|
2026-09-18 19:45:33 +00:00
|
|
|
} else {
|
|
|
|
|
hasItem = obj2.can(Permissions.SEND_MESSAGES, isPrivate) && obj2.can(Permissions.READ_MESSAGE_HISTORY, isPrivate);
|
|
|
|
|
}
|
|
|
|
|
if (hasItem) {
|
2026-09-26 17:57:22 +00:00
|
|
|
const REPLYABLE = tmp(1090).MessageTypesSets.REPLYABLE;
|
2026-09-18 19:45:33 +00:00
|
|
|
hasItem = REPLYABLE.has(type.type);
|
|
|
|
|
}
|
|
|
|
|
const currentUser = UserStore.getCurrentUser();
|
|
|
|
|
let id;
|
2026-10-01 14:13:23 +00:00
|
|
|
const userCommunicationDisabled = useUserCommunicationDisabled.userCommunicationDisabled;
|
|
|
|
|
useUserCommunicationDisabled;
|
2026-09-18 19:45:33 +00:00
|
|
|
if (currentUser != null) {
|
|
|
|
|
id = currentUser.id;
|
|
|
|
|
}
|
|
|
|
|
const guildId = isPrivate.getGuildId();
|
2026-10-01 14:13:23 +00:00
|
|
|
const state = type.state;
|
|
|
|
|
const SENT = metroRequire.SENT;
|
|
|
|
|
const tmp10 = _slicedToArray(userCommunicationDisabled(id, guildId), 2)[1];
|
|
|
|
|
const hasFlagResult = type.hasFlag(hasOwnProperty.EPHEMERAL);
|
2026-09-18 19:45:33 +00:00
|
|
|
const isArchivedThreadResult = isPrivate.isArchivedThread();
|
2026-10-01 14:13:23 +00:00
|
|
|
let tmp13 = !isArchivedThreadResult;
|
2026-09-18 19:45:33 +00:00
|
|
|
if (isArchivedThreadResult) {
|
2026-10-01 14:13:23 +00:00
|
|
|
tmp13 = canUnarchiveThreadResult;
|
2026-09-18 19:45:33 +00:00
|
|
|
}
|
|
|
|
|
if (hasItem) {
|
2026-10-01 14:13:23 +00:00
|
|
|
hasItem = state === SENT;
|
2026-09-18 19:45:33 +00:00
|
|
|
}
|
|
|
|
|
if (hasItem) {
|
|
|
|
|
hasItem = !hasFlagResult;
|
|
|
|
|
}
|
|
|
|
|
if (hasItem) {
|
2026-10-01 14:13:23 +00:00
|
|
|
hasItem = !tmp10;
|
2026-09-18 19:45:33 +00:00
|
|
|
}
|
|
|
|
|
if (hasItem) {
|
2026-10-01 14:13:23 +00:00
|
|
|
hasItem = tmp13;
|
2026-09-18 19:45:33 +00:00
|
|
|
}
|
|
|
|
|
return hasItem;
|
|
|
|
|
};
|