decord/stable/source/modules/messages/useShowConvoStarterInDM.tsx
github-actions e2bc0408ee chore: update source for stable 346.13
Skipped 1 file(s) >100MB (GitHub limit): source/__polyfill/04xxx/module_4821.js (118.4 MB)
2026-09-22 22:11:40 +00:00

100 lines
3.3 KiB
TypeScript

// Module ID: 12399
// Function ID: 12400
// Name: useShowConvoStarterInDM
// Dependencies: [19, 7322, 4857, 4285, 1371, 1074, 1964, 11501, 504, 2]
// Exports: useShowConvoStarterInDM
// Module 12399 (useShowConvoStarterInDM)
import _mod19 from "module_19" /* 19 */;
import ChannelConstants from "ChannelConstants" /* 1964 */;
import MessageRequestStore from "MessageRequestStore" /* 7322 */;
import MessageStore from "MessageStore" /* 4857 */;
import RelationshipStore from "RelationshipStore" /* 4285 */;
import UserStore from "UserStore" /* 1371 */;
import Constants from "Constants" /* 1074 */;
import size from "module_2" /* 2 */;
const require = globalThis.__r;
let useRef = _mod19.useRef;
({ RelationshipTypes: closure_7, UserFlags: closure_8 } = Constants);
const ChannelFlags = ChannelConstants.ChannelFlags;
let result = size.fileFinishedImporting("modules/messages/useShowConvoStarterInDM.tsx");
export const MAX_MESSAGES_ALLOWED_FOR_GREETING = 25;
export const useShowConvoStarterInDM = function useShowConvoStarterInDM(channel) {
_require = channel;
dependencyMap = useRef(false);
useRef = useRef(channel.id);
let tmp = channel.isDM() && !channel.isSystemDM();
if (tmp) {
const rawRecipients = channel.rawRecipients;
tmp = !rawRecipients.some((bot) => bot.bot);
}
closure_3 = tmp;
let recipientId = null;
if (tmp) {
recipientId = channel.getRecipientId();
}
const strangerDangerWarning = require("useStrangerDangerWarning").useStrangerDangerWarning(channel.id);
const hasFlagResult = channel.hasFlag(ChannelFlags.HAS_ONLY_SYSTEM_MESSAGES);
UserStore = hasFlagResult;
const obj = require("useStrangerDangerWarning");
const items = [recipientId, closure_3, strangerDangerWarning, UserStore];
const items1 = [strangerDangerWarning, tmp, channel.id, recipientId, hasFlagResult];
return require("initialize").useStateFromStores(items, () => {
if (ref2.current !== id.id) {
ref.current = false;
tmp.current = tmp2.id;
}
if (null != strangerDangerWarning) {
return false;
} else if (closure_3) {
if (MessageRequestStore.isMessageRequest(tmp2.id)) {
return false;
} else {
if (null != recipientId) {
if (RelationshipStore.getRelationshipType(tmp5) === constants.BLOCKED) {
return false;
}
}
if (null != recipientId) {
const user = UserStore.getUser(tmp5);
if (null != user) {
if (user.hasFlag(constants2.PROVISIONAL_ACCOUNT)) {
return false;
}
}
}
const messages = MessageStore.getMessages(tmp2.id);
const hasMoreBefore = messages.hasMoreBefore;
let tmp10 = !hasMoreBefore;
if (!hasMoreBefore) {
tmp10 = !messages.hasMoreAfter;
}
if (tmp10) {
tmp10 = messages.length < 25;
}
let current = messages.ready;
const result = MessageStore.hasCurrentUserSentWaveBlockingMessage(tmp2.id);
if (!current) {
current = ref.current;
}
if (current) {
let tmp13 = hasFlagResult;
if (!hasFlagResult) {
tmp13 = tmp10;
}
current = tmp13;
}
if (current) {
current = !result;
}
ref.current = current;
return current;
}
} else {
return false;
}
}, items1);
};