Skipped 1 file(s) >100MB (GitHub limit): source/__polyfill/04xxx/module_4943.js (118.4 MB)
65 lines
2.5 KiB
TypeScript
65 lines
2.5 KiB
TypeScript
// Module ID: 8021
|
|
// Function ID: 8022
|
|
// Name: ThreadAnalyticsUtils
|
|
// Dependencies: [8017, 7550, 2049, 4399, 1078, 1105, 11, 2]
|
|
// Exports: collectThreadMetadata
|
|
|
|
// Module 8021 (ThreadAnalyticsUtils)
|
|
import SnowflakeUtilsDefault from "SnowflakeUtils" /* 11 */;
|
|
import router_utils from "router_utils" /* 1105 */;
|
|
import ThreadMembersStore from "ThreadMembersStore" /* 8017 */;
|
|
import ThreadMessageStore from "ThreadMessageStore" /* 7550 */;
|
|
import PermissionStore from "PermissionStore" /* 4399 */;
|
|
|
|
require = fn;
|
|
const THREAD_CHANNEL_TYPES = fn(2049).THREAD_CHANNEL_TYPES;
|
|
const Permissions = fn(1078).Permissions;
|
|
const size = fn(2);
|
|
const result = size.fileFinishedImporting("modules/app_analytics/ThreadAnalyticsUtils.tsx");
|
|
|
|
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) {
|
|
lastRouteChangeSource = router_utils.getLastRouteChangeSource();
|
|
}
|
|
const obj2 = { location: lastRouteChangeSource, thread_approximate_member_count: ThreadMembersStore.getMemberCount(channel.id), thread_approximate_message_count: ThreadMessageStore.getCount(channel.id), 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 };
|
|
const threadMetadata = channel.threadMetadata;
|
|
let archived;
|
|
if (threadMetadata != null) {
|
|
archived = threadMetadata.archived;
|
|
}
|
|
obj2.thread_archived = true === archived;
|
|
const threadMetadata2 = channel.threadMetadata;
|
|
let flag3;
|
|
if (threadMetadata2 != null) {
|
|
flag3 = threadMetadata2.locked;
|
|
}
|
|
if (flag3 == null) {
|
|
flag3 = false;
|
|
}
|
|
obj2.thread_locked = flag3;
|
|
const threadMetadata3 = channel.threadMetadata;
|
|
let num;
|
|
if (threadMetadata3 != null) {
|
|
num = threadMetadata3.autoArchiveDuration;
|
|
}
|
|
if (num == null) {
|
|
num = 0;
|
|
}
|
|
obj2.thread_auto_archive_duration_minutes = num;
|
|
obj2.thread_approximate_creation_date = SnowflakeUtilsDefault.extractTimestamp(channel.id);
|
|
obj2.can_send_message = PermissionStore.can(Permissions.SEND_MESSAGES, channel);
|
|
obj2.parent_channel_type = channel.parentChannelThreadType;
|
|
tmp = obj2;
|
|
}
|
|
}
|
|
return tmp;
|
|
};
|