decord/source/modules/app_analytics/ThreadAnalyticsUtils.tsx

70 lines
2.4 KiB
TypeScript
Raw Normal View History

2026-08-27 16:17:25 +00:00
// Module ID: 7451
// Function ID: 7452
2026-07-20 16:05:17 +00:00
// Name: collectThreadMetadata
2026-08-27 16:17:25 +00:00
// Dependencies: [7447, 6103, 1395, 4089, 676, 1222, 11, 2]
2026-07-20 16:05:17 +00:00
// Exports: collectThreadMetadata
2026-08-27 16:17:25 +00:00
// Module 7451 (collectThreadMetadata)
2026-08-24 06:08:38 +00:00
import DISCORD_EPOCHDefault from "DISCORD_EPOCH" /* 11 */;
import transitionTo from "transitionTo" /* 1222 */;
2026-08-27 16:17:25 +00:00
import closure_3 from "updateFromGuild" /* 7447 */;
import closure_4 from "updateState" /* 6103 */;
2026-08-24 06:08:38 +00:00
import { THREAD_CHANNEL_TYPES } from "createChannelRecord" /* 1395 */;
2026-08-26 06:04:24 +00:00
import closure_6 from "getUncachedChannelPermissions" /* 4089 */;
2026-08-24 06:08:38 +00:00
import { Permissions } from "ME" /* 676 */;
2026-07-23 10:11:24 +00:00
2026-08-24 06:08:38 +00:00
require = arg1;
const result = require("set").fileFinishedImporting("modules/app_analytics/ThreadAnalyticsUtils.tsx");
2026-07-20 16:05:17 +00:00
export const collectThreadMetadata = function collectThreadMetadata(channel, arg1) {
let flag = arg1;
if (arg1 === undefined) {
flag = false;
}
let tmp = null;
if (null != channel) {
tmp = null;
if (THREAD_CHANNEL_TYPES.has(channel.type)) {
let lastRouteChangeSource;
if (flag) {
2026-08-24 06:08:38 +00:00
let obj = transitionTo;
2026-07-29 08:29:29 +00:00
lastRouteChangeSource = obj.getLastRouteChangeSource();
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
obj = { location: null, thread_approximate_member_count: null, thread_approximate_message_count: null, thread_archived: null, thread_locked: null, thread_auto_archive_duration_minutes: null, thread_approximate_creation_date: null, can_send_message: null, parent_channel_type: null };
obj[0] = lastRouteChangeSource;
obj[1] = memberCount.getMemberCount(channel.id);
obj[2] = count.getCount(channel.id);
2026-07-20 16:05:17 +00:00
const threadMetadata = channel.threadMetadata;
let archived;
2026-07-29 08:29:29 +00:00
if (threadMetadata != null) {
2026-07-20 16:05:17 +00:00
archived = threadMetadata.archived;
}
2026-07-29 08:29:29 +00:00
obj[3] = true === archived;
2026-07-20 16:05:17 +00:00
const threadMetadata2 = channel.threadMetadata;
2026-07-29 08:29:29 +00:00
let flag3;
if (threadMetadata2 != null) {
flag3 = threadMetadata2.locked;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
if (flag3 == null) {
flag3 = false;
}
obj[4] = flag3;
2026-07-20 16:05:17 +00:00
const threadMetadata3 = channel.threadMetadata;
2026-07-29 08:29:29 +00:00
let num;
if (threadMetadata3 != null) {
num = threadMetadata3.autoArchiveDuration;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
if (num == null) {
num = 0;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
obj[5] = num;
2026-08-24 06:08:38 +00:00
obj[6] = DISCORD_EPOCHDefault.extractTimestamp(channel.id);
obj[7] = closure_6.can(Permissions.SEND_MESSAGES, channel);
2026-07-29 08:29:29 +00:00
obj[8] = channel.parentChannelThreadType;
2026-07-20 16:05:17 +00:00
tmp = obj;
2026-08-24 06:08:38 +00:00
const obj3 = DISCORD_EPOCHDefault;
2026-07-20 16:05:17 +00:00
}
}
return tmp;
};