decord/source/stores/PrivateChannelReadStateStore.tsx

209 lines
6.7 KiB
TypeScript
Raw Normal View History

2026-08-05 07:35:12 +00:00
// Module ID: 12893
// Function ID: 12894
2026-07-29 08:29:29 +00:00
// Name: rebuildUnreads
2026-08-05 07:35:12 +00:00
// Dependencies: [1376, 1372, 4267, 1931, 5734, 1941, 589, 709, 2]
2026-07-20 16:05:17 +00:00
2026-08-05 07:35:12 +00:00
// Module 12893 (rebuildUnreads)
2026-07-29 08:29:29 +00:00
import { isPrivate } from "createChannelRecord";
import ensureGuildLoaded from "ensureGuildLoaded";
import generateOldThreadCutoff from "generateOldThreadCutoff";
import handleConnectionOpen from "handleConnectionOpen";
import makeSortedChannel from "makeSortedChannel";
import { Store } from "initialize";
import set from "generateOldThreadCutoff";
2026-07-23 10:11:24 +00:00
2026-07-20 16:05:17 +00:00
function rebuildUnreads() {
2026-07-29 08:29:29 +00:00
const privateChannelIds = store2.getPrivateChannelIds();
const found = privateChannelIds.filter((arg0) => mentionCount.getMentionCount(arg0) > 0);
2026-07-20 16:05:17 +00:00
if (found.length > 20) {
found.length = 20;
}
2026-07-29 08:29:29 +00:00
const result = require(1941) /* areArraysShallowlyEqual */.areArraysShallowlyEqual(found, found);
let flag = !result;
if (!result) {
2026-07-20 16:05:17 +00:00
const _Set = Set;
const set = new Set(found);
flag = true;
}
return flag;
}
function handleConnectionOpen() {
2026-07-29 08:29:29 +00:00
const privateChannelIds = store2.getPrivateChannelIds();
const found = privateChannelIds.filter((arg0) => mentionCount.getMentionCount(arg0) > 0);
if (found.length > 20) {
found.length = 20;
}
const result = require(1941) /* areArraysShallowlyEqual */.areArraysShallowlyEqual(found, found);
let flag = !result;
if (!result) {
const _Set = Set;
const set = new Set(found);
flag = true;
}
return flag;
2026-07-20 16:05:17 +00:00
}
function handleGenericUpdate(channelId) {
const channel = store.getChannel(channelId.channelId);
let tmp2 = null == channel;
if (!tmp2) {
tmp2 = !isPrivate(channel.type);
}
let tmp4 = !tmp2;
if (!tmp2) {
2026-07-29 08:29:29 +00:00
const privateChannelIds = store2.getPrivateChannelIds();
const found = privateChannelIds.filter((arg0) => mentionCount.getMentionCount(arg0) > 0);
if (found.length > 20) {
found.length = 20;
}
const result = require(1941) /* areArraysShallowlyEqual */.areArraysShallowlyEqual(found, found);
let flag = !result;
if (!result) {
const _Set = Set;
const set = new Set(found);
flag = true;
}
tmp4 = flag;
const obj = require(1941) /* areArraysShallowlyEqual */;
2026-07-20 16:05:17 +00:00
}
return tmp4;
}
2026-07-29 08:29:29 +00:00
let closure_7 = [];
2026-07-23 10:11:24 +00:00
let set = new Set();
2026-07-29 08:29:29 +00:00
class PrivateChannelReadStateStore extends Store {
}
const prototype = PrivateChannelReadStateStore.prototype;
prototype["initialize"] = function initialize() {
this.waitFor(makeSortedChannel, ensureGuildLoaded, handleConnectionOpen, generateOldThreadCutoff);
};
prototype["getUnreadPrivateChannelIds"] = function getUnreadPrivateChannelIds() {
return closure_7;
};
PrivateChannelReadStateStore.displayName = "PrivateChannelReadStateStore";
const privateChannelReadStateStore = new PrivateChannelReadStateStore(require("dispatcher"), {
2026-07-20 16:05:17 +00:00
CONNECTION_OPEN: handleConnectionOpen,
OVERLAY_INITIALIZE: handleConnectionOpen,
MESSAGE_CREATE: handleGenericUpdate,
MESSAGE_ACK: handleGenericUpdate,
CHANNEL_SELECT: function handleChannelSelect(channelId) {
const channel = store.getChannel(channelId.channelId);
let tmp2 = null == channel;
if (!tmp2) {
tmp2 = !isPrivate(channel.type);
}
let tmp4 = !tmp2;
if (!tmp2) {
2026-07-29 08:29:29 +00:00
const privateChannelIds = store2.getPrivateChannelIds();
const found = privateChannelIds.filter((arg0) => mentionCount.getMentionCount(arg0) > 0);
if (found.length > 20) {
found.length = 20;
}
const result = require(1941) /* areArraysShallowlyEqual */.areArraysShallowlyEqual(found, found);
let flag = !result;
if (!result) {
const _Set = Set;
const set = new Set(found);
flag = true;
}
tmp4 = flag;
const obj = require(1941) /* areArraysShallowlyEqual */;
2026-07-20 16:05:17 +00:00
}
return tmp4;
},
CHANNEL_DELETE: function handleChannelDelete(channel) {
2026-07-29 08:29:29 +00:00
let hasItem = set.has(channel.channel.id);
if (hasItem) {
const privateChannelIds = store2.getPrivateChannelIds();
const found = privateChannelIds.filter((arg0) => mentionCount.getMentionCount(arg0) > 0);
if (found.length > 20) {
found.length = 20;
}
const result = require(1941) /* areArraysShallowlyEqual */.areArraysShallowlyEqual(found, found);
let flag = !result;
if (!result) {
const _Set = Set;
set = new Set(found);
flag = true;
}
hasItem = flag;
const obj = require(1941) /* areArraysShallowlyEqual */;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
return hasItem;
2026-07-20 16:05:17 +00:00
},
WINDOW_FOCUS: function handleWindowFocus() {
const channel = store.getChannel(channelId.getChannelId());
let tmp2 = null == channel;
if (!tmp2) {
tmp2 = !isPrivate(channel.type);
}
let tmp4 = !tmp2;
if (!tmp2) {
2026-07-29 08:29:29 +00:00
const privateChannelIds = store2.getPrivateChannelIds();
const found = privateChannelIds.filter((arg0) => mentionCount.getMentionCount(arg0) > 0);
if (found.length > 20) {
found.length = 20;
}
const result = require(1941) /* areArraysShallowlyEqual */.areArraysShallowlyEqual(found, found);
let flag = !result;
if (!result) {
const _Set = Set;
const set = new Set(found);
flag = true;
}
tmp4 = flag;
const obj = require(1941) /* areArraysShallowlyEqual */;
2026-07-20 16:05:17 +00:00
}
return tmp4;
},
CHANNEL_CREATE: function handleChannelCreate(channel) {
channel = store.getChannel(channel.channel.id);
let tmp2 = null == channel;
if (!tmp2) {
tmp2 = !isPrivate(channel.type);
}
let tmp4 = !tmp2;
if (!tmp2) {
2026-07-29 08:29:29 +00:00
const privateChannelIds = store2.getPrivateChannelIds();
const found = privateChannelIds.filter((arg0) => mentionCount.getMentionCount(arg0) > 0);
if (found.length > 20) {
found.length = 20;
}
const result = require(1941) /* areArraysShallowlyEqual */.areArraysShallowlyEqual(found, found);
let flag = !result;
if (!result) {
const _Set = Set;
const set = new Set(found);
flag = true;
}
tmp4 = flag;
const obj = require(1941) /* areArraysShallowlyEqual */;
2026-07-20 16:05:17 +00:00
}
return tmp4;
},
2026-07-29 08:29:29 +00:00
CHANNEL_UPDATES: function handleChannelUpdates(arg0) {
2026-07-20 16:05:17 +00:00
let flag = false;
2026-07-29 08:29:29 +00:00
const iter = arg0.channels[Symbol.iterator]();
while (iter !== undefined) {
let tmp = store;
let channel = store.getChannel(iter.next().id);
let tmp4 = null != channel;
if (tmp4) {
let tmp5 = isPrivate;
let tmp6 = channel;
tmp4 = isPrivate(tmp3.type);
}
if (tmp4) {
flag = true;
}
continue;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
let tmp7 = flag;
if (tmp7) {
tmp7 = rebuildUnreads();
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
return tmp7;
2026-07-20 16:05:17 +00:00
}
});
2026-07-23 10:11:24 +00:00
let result = set.fileFinishedImporting("stores/PrivateChannelReadStateStore.tsx");
2026-07-20 16:05:17 +00:00
2026-07-29 08:29:29 +00:00
export default privateChannelReadStateStore;