decord/source/modules/app_analytics/ThreadAnalyticsUtils.tsx

68 lines
2.4 KiB
TypeScript
Raw Normal View History

2026-08-15 05:55:55 +00:00
// Module ID: 7521
// Function ID: 7522
2026-07-20 16:05:17 +00:00
// Name: collectThreadMetadata
2026-08-15 05:55:55 +00:00
// Dependencies: [7517, 7271, 1395, 4021, 676, 1222, 11, 2]
2026-07-20 16:05:17 +00:00
// Exports: collectThreadMetadata
2026-08-15 05:55:55 +00:00
// Module 7521 (collectThreadMetadata)
2026-07-29 08:29:29 +00:00
import updateFromGuild from "updateFromGuild";
import updateState from "updateState";
import { THREAD_CHANNEL_TYPES } from "createChannelRecord";
import getUncachedChannelPermissions from "getUncachedChannelPermissions";
2026-07-23 10:11:24 +00:00
import { Permissions } from "ME";
const require = arg1;
2026-07-29 08:29:29 +00:00
const result = require("createChannelRecord").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-07-29 08:29:29 +00:00
let obj = require(1222) /* transitionTo */;
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;
obj[6] = importDefault(11).extractTimestamp(channel.id);
obj[7] = getUncachedChannelPermissions.can(Permissions.SEND_MESSAGES, channel);
obj[8] = channel.parentChannelThreadType;
2026-07-20 16:05:17 +00:00
tmp = obj;
2026-07-29 08:29:29 +00:00
const obj3 = importDefault(11);
2026-07-20 16:05:17 +00:00
}
}
return tmp;
};