decord/alpha/source/modules/replies/canReplyToMessage.tsx

225 lines
7.1 KiB
TypeScript
Raw Permalink Normal View History

2026-10-12 06:59:38 +00:00
// Module ID: 7994
// Function ID: 7995
// Name: canReplyToMessage
2026-10-12 06:59:38 +00:00
// Dependencies: [32, 4750, 1390, 1085, 1096, 1101, 558, 576, 6972, 7995, 504, 2]
2026-10-03 08:58:59 +00:00
// Exports: canReplyToMessage
2026-07-20 16:05:17 +00:00
2026-10-12 06:59:38 +00:00
// Module 7994 (canReplyToMessage)
2026-10-03 08:58:59 +00:00
import Constants2 from "Constants" /* 1096 */;
import MessageTypes from "MessageTypes" /* 1101 */;
2026-10-12 06:59:38 +00:00
import ThreadHooks from "ThreadHooks" /* 6972 */;
import useUserCommunicationDisabled from "useUserCommunicationDisabled" /* 7995 */;
2026-10-03 08:58:59 +00:00
import _slicedToArray from "_slicedToArray" /* 32 */;
2026-10-10 08:08:14 +00:00
import PermissionStore from "PermissionStore" /* 4750 */;
2026-10-09 10:00:15 +00:00
import UserStore from "UserStore" /* 1390 */;
2026-10-03 08:58:59 +00:00
import Constants from "Constants" /* 1085 */;
import ReactCompilerGating from "ReactCompilerGating" /* 558 */;
import size from "module_2" /* 2 */;
2026-07-23 10:11:24 +00:00
const require = globalThis.__r;
2026-10-03 08:58:59 +00:00
let _require, dependencyMap;
2026-10-03 08:58:59 +00:00
let hasOwnProperty;
let metroRequire;
({ MessageFlags: hasOwnProperty, MessageStates: metroRequire } = Constants);
2026-10-03 08:58:59 +00:00
const Permissions = Constants2.Permissions;
2026-10-08 09:57:35 +00:00
let tmp3 = ReactCompilerGating.isReactCompilerEnabled() ? (function useCanReplyToMessage(getGuildId, hasFlag) {
2026-10-03 08:58:59 +00:00
let tmp5;
let tmp9;
_require = getGuildId;
dependencyMap = hasFlag;
2026-07-29 08:29:29 +00:00
let tmp = _require;
2026-10-03 08:58:59 +00:00
const obj = require("react");
const cResult = obj.c(12);
const obj2 = require("ThreadHooks");
const canUnarchiveThread = obj2.useCanUnarchiveThread(getGuildId);
if (cResult[0] !== getGuildId) {
let guildId;
if (getGuildId != null) {
guildId = getGuildId.getGuildId();
}
cResult[0] = getGuildId;
cResult[1] = guildId;
tmp5 = guildId;
} else {
tmp5 = cResult[1];
2026-07-20 16:05:17 +00:00
}
2026-10-12 06:59:38 +00:00
const tmpResult = tmp(7995);
2026-10-03 08:58:59 +00:00
const tmp8 = _slicedToArray(tmpResult.useCurrentUserCommunicationDisabled(tmp5), 2)[1];
if (cResult[2] === Symbol.for("react.memo_cache_sentinel")) {
const items = [PermissionStore];
cResult[2] = items;
tmp9 = items;
} else {
tmp9 = cResult[2];
}
if (cResult[3] === getGuildId) {
let tmp11;
if (cResult[4] === hasFlag) {
tmp11 = cResult[5];
}
const tmpResult2 = tmp(504);
const stateFromStores = tmpResult2.useStateFromStores(tmp9, tmp11);
let tmp14 = null != getGuildId && null != hasFlag;
if (tmp14) {
if (cResult[6] === stateFromStores) {
if (cResult[7] === canUnarchiveThread) {
if (cResult[8] === getGuildId) {
if (cResult[9] === tmp8) {
let tmp15;
if (cResult[10] === hasFlag) {
tmp15 = cResult[11];
}
tmp14 = tmp15;
}
}
}
}
const state = hasFlag.state;
const SENT = constants2.SENT;
const hasFlagResult = hasFlag.hasFlag(constants.EPHEMERAL);
const isArchivedThreadResult = getGuildId.isArchivedThread();
let tmp20 = !isArchivedThreadResult;
if (isArchivedThreadResult) {
tmp20 = canUnarchiveThread;
}
const tmp21 = stateFromStores && state === SENT && !hasFlagResult && !tmp8 && tmp20;
cResult[6] = stateFromStores;
cResult[7] = canUnarchiveThread;
cResult[8] = getGuildId;
cResult[9] = tmp8;
cResult[10] = hasFlag;
cResult[11] = tmp21;
tmp15 = tmp21;
}
return tmp14;
}
2026-10-08 09:57:35 +00:00
const fn = function y() {
2026-10-03 08:58:59 +00:00
let tmp = null != getGuildId && null != hasFlag;
2026-07-20 16:05:17 +00:00
if (tmp) {
2026-10-03 08:58:59 +00:00
let hasItem;
const tmp3 = hasFlag;
if (getGuildId.isPrivate()) {
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;
2026-07-20 16:05:17 +00:00
}
2026-10-03 08:58:59 +00:00
return tmp;
};
cResult[3] = getGuildId;
cResult[4] = hasFlag;
cResult[5] = fn;
tmp11 = fn;
2026-10-08 09:57:35 +00:00
}) : (function useCanReplyToMessage(getGuildId, hasFlag) {
2026-10-03 08:58:59 +00:00
_require = getGuildId;
dependencyMap = hasFlag;
let tmp = _require;
const obj = require("ThreadHooks");
const canUnarchiveThread = obj.useCanUnarchiveThread(getGuildId);
const tmp4 = require("useUserCommunicationDisabled");
let guildId;
const useCurrentUserCommunicationDisabled = tmp4.useCurrentUserCommunicationDisabled;
if (getGuildId != null) {
guildId = getGuildId.getGuildId();
}
const items = [PermissionStore];
const tmp6 = _slicedToArray(useCurrentUserCommunicationDisabled(guildId), 2)[1];
const tmpResult = tmp(504);
let stateFromStores = tmpResult.useStateFromStores(items, () => {
let tmp = null != getGuildId && null != hasFlag;
2026-07-20 16:05:17 +00:00
if (tmp) {
2026-10-03 08:58:59 +00:00
let hasItem;
const tmp3 = hasFlag;
if (getGuildId.isPrivate()) {
hasItem = !obj.isSystemDM();
2026-07-29 08:29:29 +00:00
} else {
hasItem = obj2.can(Permissions.SEND_MESSAGES, obj) && obj2.can(Permissions.READ_MESSAGE_HISTORY, obj);
2026-07-29 08:29:29 +00:00
}
if (hasItem) {
const REPLYABLE = MessageTypes.MessageTypesSets.REPLYABLE;
2026-07-29 08:29:29 +00:00
hasItem = REPLYABLE.has(tmp3.type);
}
tmp = hasItem;
2026-07-20 16:05:17 +00:00
}
return tmp;
});
2026-10-03 08:58:59 +00:00
let tmp8 = null != getGuildId && null != hasFlag;
if (tmp8) {
const state = hasFlag.state;
const SENT = constants2.SENT;
const hasFlagResult = hasFlag.hasFlag(constants.EPHEMERAL);
const isArchivedThreadResult = getGuildId.isArchivedThread();
let tmp13 = !isArchivedThreadResult;
2026-07-29 08:29:29 +00:00
if (isArchivedThreadResult) {
2026-10-03 08:58:59 +00:00
tmp13 = canUnarchiveThread;
2026-07-29 08:29:29 +00:00
}
if (stateFromStores) {
2026-10-03 08:58:59 +00:00
stateFromStores = state === SENT;
2026-07-29 08:29:29 +00:00
}
if (stateFromStores) {
stateFromStores = !hasFlagResult;
}
if (stateFromStores) {
2026-10-03 08:58:59 +00:00
stateFromStores = !tmp6;
2026-07-29 08:29:29 +00:00
}
if (stateFromStores) {
2026-10-03 08:58:59 +00:00
stateFromStores = tmp13;
2026-07-29 08:29:29 +00:00
}
2026-10-03 08:58:59 +00:00
tmp8 = stateFromStores;
2026-07-20 16:05:17 +00:00
}
2026-10-03 08:58:59 +00:00
return tmp8;
});
const result = size.fileFinishedImporting("modules/replies/canReplyToMessage.tsx");
export const useCanReplyToMessage = tmp3;
2026-08-13 07:00:46 +00:00
export const canReplyToMessage = function canReplyToMessage(isPrivate, type) {
2026-10-03 08:58:59 +00:00
let hasItem;
const obj = ThreadHooks;
const canUnarchiveThreadResult = obj.canUnarchiveThread(isPrivate);
2026-08-13 07:00:46 +00:00
if (isPrivate.isPrivate()) {
2026-10-03 08:58:59 +00:00
hasItem = !isPrivate.isSystemDM();
2026-07-29 08:29:29 +00:00
} else {
2026-08-13 07:00:46 +00:00
hasItem = obj2.can(Permissions.SEND_MESSAGES, isPrivate) && obj2.can(Permissions.READ_MESSAGE_HISTORY, isPrivate);
2026-07-29 08:29:29 +00:00
}
if (hasItem) {
2026-10-03 08:58:59 +00:00
const REPLYABLE = tmp(1101).MessageTypesSets.REPLYABLE;
2026-08-13 07:00:46 +00:00
hasItem = REPLYABLE.has(type.type);
2026-07-29 08:29:29 +00:00
}
const currentUser = UserStore.getCurrentUser();
2026-07-20 16:05:17 +00:00
let id;
2026-10-03 08:58:59 +00:00
const userCommunicationDisabled = useUserCommunicationDisabled.userCommunicationDisabled;
useUserCommunicationDisabled;
2026-07-29 08:29:29 +00:00
if (currentUser != null) {
2026-07-20 16:05:17 +00:00
id = currentUser.id;
}
2026-08-13 07:00:46 +00:00
const guildId = isPrivate.getGuildId();
2026-10-03 08:58:59 +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-08-13 07:00:46 +00:00
const isArchivedThreadResult = isPrivate.isArchivedThread();
2026-10-03 08:58:59 +00:00
let tmp13 = !isArchivedThreadResult;
2026-07-29 08:29:29 +00:00
if (isArchivedThreadResult) {
2026-10-03 08:58:59 +00:00
tmp13 = canUnarchiveThreadResult;
2026-07-29 08:29:29 +00:00
}
if (hasItem) {
2026-10-03 08:58:59 +00:00
hasItem = state === SENT;
2026-07-29 08:29:29 +00:00
}
if (hasItem) {
hasItem = !hasFlagResult;
}
if (hasItem) {
2026-10-03 08:58:59 +00:00
hasItem = !tmp10;
2026-07-29 08:29:29 +00:00
}
if (hasItem) {
2026-10-03 08:58:59 +00:00
hasItem = tmp13;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
return hasItem;
2026-07-20 16:05:17 +00:00
};