decord/source/modules/threads/getThreadAutoArchiveTimeOnce.tsx

70 lines
2.5 KiB
TypeScript
Raw Normal View History

// Module ID: 5596
// Function ID: 5597
2026-07-29 08:29:29 +00:00
// Name: getThreadAutoArchiveTimeOnce
// Dependencies: [4655, 1091, 11, 2]
2026-07-29 08:29:29 +00:00
// Exports: default, getThreadLastActivityTime
2026-07-20 16:05:17 +00:00
// Module 5596 (getThreadAutoArchiveTimeOnce)
import SnowflakeUtilsDefault from "SnowflakeUtils" /* 11 */;
import DurationsDefault from "Durations" /* 1091 */;
import ReadStateStore from "ReadStateStore" /* 4655 */;
2026-07-23 10:11:24 +00:00
const size = fn(2);
let result = size.fileFinishedImporting("modules/threads/getThreadAutoArchiveTimeOnce.tsx");
2026-07-29 08:29:29 +00:00
export default function getThreadAutoArchiveTimeOnce(threadMetadata) {
if (null == threadMetadata.threadMetadata) {
return 0;
} else {
let num3 = 0;
const result = threadMetadata.threadMetadata.autoArchiveDuration * DurationsDefault.Millis.MINUTE;
2026-07-29 08:29:29 +00:00
if (null != threadMetadata.threadMetadata) {
let id = ReadStateStore.lastMessageId(threadMetadata.id);
2026-07-29 08:29:29 +00:00
if (id == null) {
id = threadMetadata.id;
}
let num = 0;
const tmp12Result = SnowflakeUtilsDefault;
2026-07-29 08:29:29 +00:00
if (null != threadMetadata.lastNonMessageActivityTimestamp) {
const _Date = Date;
const date = new Date(threadMetadata.lastNonMessageActivityTimestamp);
num = date.getTime();
}
let num2 = 0;
if (null != threadMetadata.threadMetadata.archiveTimestamp) {
const _Date2 = Date;
const date1 = new Date(threadMetadata.threadMetadata.archiveTimestamp);
num2 = date1.getTime();
}
const _Math = Math;
num3 = Math.max(SnowflakeUtilsDefault.extractTimestamp(id), num, num2);
const extractTimestampResult = SnowflakeUtilsDefault.extractTimestamp(id);
2026-07-29 08:29:29 +00:00
}
return num3 + result;
}
};
export const getThreadLastActivityTime = function getThreadLastActivityTime(threadMetadata) {
2026-07-20 16:05:17 +00:00
if (null == threadMetadata.threadMetadata) {
return 0;
} else {
let id = ReadStateStore.lastMessageId(threadMetadata.id);
2026-07-29 08:29:29 +00:00
if (id == null) {
2026-07-20 16:05:17 +00:00
id = threadMetadata.id;
}
2026-07-29 08:29:29 +00:00
let num = 0;
2026-07-21 06:55:02 +00:00
if (null != threadMetadata.lastNonMessageActivityTimestamp) {
2026-07-20 16:05:17 +00:00
const _Date = Date;
2026-07-21 06:55:02 +00:00
const date = new Date(threadMetadata.lastNonMessageActivityTimestamp);
2026-07-29 08:29:29 +00:00
num = date.getTime();
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
let num2 = 0;
2026-07-21 06:55:02 +00:00
if (null != threadMetadata.threadMetadata.archiveTimestamp) {
const _Date2 = Date;
const date1 = new Date(threadMetadata.threadMetadata.archiveTimestamp);
2026-07-29 08:29:29 +00:00
num2 = date1.getTime();
2026-07-21 06:55:02 +00:00
}
2026-07-20 16:05:17 +00:00
const _Math = Math;
return Math.max(SnowflakeUtilsDefault.extractTimestamp(id), num, num2);
2026-07-20 16:05:17 +00:00
}
};