Files
discord-decomp/modules/messages/isMessagePinnable.tsx
T
2026-11-01 12:12:55 +02:00

30 lines
916 B
TypeScript

// Metro module 9560 (f9561).
import PermissionStore from "../../stores/PermissionStore";
import { ChannelTypes, Permissions } from "../../Constants";
import isSystemMessage from "./isSystemMessage";
import { getIsActiveChannelOrUnarchivableThread } from "../threads/ThreadHooks";
export default function isMessagePinnable(a0, a1) {
const isSystemDM = a1.isSystemDM();
let r8 = isSystemDM ? !isSystemDM : !isSystemMessage(a0);
let r16 = PermissionStore.can(Permissions.PIN_MESSAGES, a1) && PermissionStore.can(Permissions.READ_MESSAGE_HISTORY, a1);
if (r8) {
if (!r16) {
r16 = a1.isPrivate();
}
r8 = r16;
}
if (r8) {
r8 = getIsActiveChannelOrUnarchivableThread(a1);
}
if (r8) {
r8 = a1.type !== ChannelTypes.GUILD_VOICE;
}
if (r8) {
r8 = a1.type !== ChannelTypes.GUILD_STAGE_VOICE;
}
if (r8) {
r8 = a1.type !== ChannelTypes.MEDIA_THREAD;
}
return r8;
};