decord/alpha/source/modules/threads/ThreadMembersStore.tsx

295 lines
9.6 KiB
TypeScript
Raw Normal View History

2026-10-12 06:59:38 +00:00
// Module ID: 7907
// Function ID: 7908
// Name: ThreadMembersStore
2026-10-10 08:08:14 +00:00
// Dependencies: [2069, 2065, 12, 504, 584, 2]
2026-07-23 10:11:24 +00:00
2026-10-12 06:59:38 +00:00
// Module 7907 (ThreadMembersStore)
import _modDef12 from "module_12" /* 12 */;
2026-10-03 08:58:59 +00:00
import get_initializedDefault from "get initialized" /* 504 */;
import DispatcherDefault from "Dispatcher" /* 584 */;
2026-10-10 08:08:14 +00:00
import ChannelRecord from "ChannelRecord" /* 2069 */;
import ChannelStore from "ChannelStore" /* 2065 */;
import size from "module_2" /* 2 */;
2026-07-20 16:05:17 +00:00
2026-10-03 08:58:59 +00:00
let thread;
2026-07-20 16:05:17 +00:00
function updateFromGuild(threads) {
threads = threads.threads;
2026-07-29 08:29:29 +00:00
if (threads != null) {
2026-07-20 16:05:17 +00:00
const item = threads.forEach(updateFromThread);
}
}
function updateFromThread(type) {
2026-10-03 08:58:59 +00:00
let memberCount;
let memberIdsPreview;
2026-07-20 16:05:17 +00:00
if (ALL_CHANNEL_TYPES.has(type.type)) {
2026-10-03 08:58:59 +00:00
if (!(type.id in closure_4)) {
const obj = { guildId: null, parentId: null, memberCount, memberIdsPreview };
({ guild_id: obj.guildId, parent_id: obj.parentId, memberCount } = type);
2026-10-03 08:58:59 +00:00
const id = type.id;
const tmp2 = closure_4;
2026-07-29 08:29:29 +00:00
if (memberCount == null) {
memberCount = 0;
2026-07-20 16:05:17 +00:00
}
2026-10-03 08:58:59 +00:00
memberIdsPreview = type.memberIdsPreview;
2026-07-29 08:29:29 +00:00
if (memberIdsPreview == null) {
2026-07-20 16:05:17 +00:00
memberIdsPreview = [];
}
2026-10-03 08:58:59 +00:00
tmp2[id] = obj;
2026-07-20 16:05:17 +00:00
}
if (null != type.memberCount) {
2026-10-03 08:58:59 +00:00
closure_4[type.id].memberCount = type.memberCount;
2026-07-20 16:05:17 +00:00
}
if (null != type.memberIdsPreview) {
2026-10-03 08:58:59 +00:00
closure_4[type.id].memberIdsPreview = type.memberIdsPreview;
2026-07-20 16:05:17 +00:00
}
} else {
return false;
}
}
function handleThreadCreateOrUpdate(channel) {
2026-10-03 08:58:59 +00:00
let memberCount;
let memberIdsPreview;
2026-07-29 08:29:29 +00:00
channel = channel.channel;
if (ALL_CHANNEL_TYPES.has(channel.type)) {
2026-10-03 08:58:59 +00:00
if (!(channel.id in closure_4)) {
const obj = { guildId: null, parentId: null, memberCount, memberIdsPreview };
({ guild_id: obj.guildId, parent_id: obj.parentId, memberCount } = channel);
2026-10-03 08:58:59 +00:00
const id = channel.id;
const tmp2 = closure_4;
2026-07-29 08:29:29 +00:00
if (memberCount == null) {
memberCount = 0;
}
2026-10-03 08:58:59 +00:00
memberIdsPreview = channel.memberIdsPreview;
2026-07-29 08:29:29 +00:00
if (memberIdsPreview == null) {
memberIdsPreview = [];
}
2026-10-03 08:58:59 +00:00
tmp2[id] = obj;
2026-07-29 08:29:29 +00:00
}
if (null != channel.memberCount) {
2026-10-03 08:58:59 +00:00
closure_4[channel.id].memberCount = channel.memberCount;
2026-07-29 08:29:29 +00:00
}
if (null != channel.memberIdsPreview) {
2026-10-03 08:58:59 +00:00
closure_4[channel.id].memberIdsPreview = channel.memberIdsPreview;
2026-07-29 08:29:29 +00:00
}
}
return false;
2026-07-20 16:05:17 +00:00
}
function handleLoadArchivedThreadsSuccess(threads) {
threads = threads.threads;
const item = threads.forEach(updateFromServerThread);
}
function handleSearchMessagesSuccess(data) {
data = data.data;
2026-10-03 08:58:59 +00:00
let c0 = false;
let item = data.forEach((item) => {
2026-10-03 08:58:59 +00:00
let flag;
let messages;
let threads;
({ threads, messages } = item);
item = messages.forEach((arr) => {
2026-07-20 16:05:17 +00:00
const item = arr.forEach((thread) => {
2026-10-03 08:58:59 +00:00
let memberCount;
let memberIdsPreview;
2026-07-29 08:29:29 +00:00
thread = thread.thread;
if (null != thread) {
if (!(thread.id in closure_2_4)) {
channel = channel.getChannel(thread.id);
2026-07-29 08:29:29 +00:00
if (null != channel) {
if (set.has(channel.type)) {
if (!(channel.id in closure_2_4)) {
2026-10-03 08:58:59 +00:00
const obj = { guildId: null, parentId: null, memberCount, memberIdsPreview };
({ guild_id: obj.guildId, parent_id: obj.parentId, memberCount } = channel);
2026-10-03 08:58:59 +00:00
const id = channel.id;
const tmp6 = closure_2_4;
2026-07-29 08:29:29 +00:00
if (memberCount == null) {
memberCount = 0;
}
2026-10-03 08:58:59 +00:00
memberIdsPreview = channel.memberIdsPreview;
2026-07-29 08:29:29 +00:00
if (memberIdsPreview == null) {
memberIdsPreview = [];
}
2026-10-03 08:58:59 +00:00
tmp6[id] = obj;
2026-07-29 08:29:29 +00:00
}
if (null != channel.memberCount) {
2026-10-03 08:58:59 +00:00
closure_2_4[channel.id].memberCount = channel.memberCount;
2026-07-29 08:29:29 +00:00
}
if (null != channel.memberIdsPreview) {
2026-10-03 08:58:59 +00:00
closure_2_4[channel.id].memberIdsPreview = channel.memberIdsPreview;
2026-07-29 08:29:29 +00:00
}
}
}
}
}
2026-07-20 16:05:17 +00:00
});
});
2026-07-29 08:29:29 +00:00
const item1 = threads.forEach((id) => {
2026-10-03 08:58:59 +00:00
let memberCount;
let memberIdsPreview;
2026-07-29 08:29:29 +00:00
if (null != id) {
2026-10-03 08:58:59 +00:00
if (!(id.id in closure_2_4)) {
channel = channel.getChannel(id.id);
2026-07-29 08:29:29 +00:00
if (null != channel) {
if (set.has(channel.type)) {
2026-10-03 08:58:59 +00:00
if (!(channel.id in closure_2_4)) {
const obj = { guildId: null, parentId: null, memberCount, memberIdsPreview };
({ guild_id: obj.guildId, parent_id: obj.parentId, memberCount } = channel);
2026-10-03 08:58:59 +00:00
id = channel.id;
const tmp6 = closure_2_4;
2026-07-29 08:29:29 +00:00
if (memberCount == null) {
memberCount = 0;
}
2026-10-03 08:58:59 +00:00
memberIdsPreview = channel.memberIdsPreview;
2026-07-29 08:29:29 +00:00
if (memberIdsPreview == null) {
memberIdsPreview = [];
}
2026-10-03 08:58:59 +00:00
tmp6[id] = obj;
2026-07-29 08:29:29 +00:00
}
if (null != channel.memberCount) {
2026-10-03 08:58:59 +00:00
closure_2_4[channel.id].memberCount = channel.memberCount;
2026-07-29 08:29:29 +00:00
}
if (null != channel.memberIdsPreview) {
2026-10-03 08:58:59 +00:00
closure_2_4[channel.id].memberIdsPreview = channel.memberIdsPreview;
2026-07-29 08:29:29 +00:00
}
}
}
}
}
2026-07-20 16:05:17 +00:00
});
});
2026-07-23 10:11:24 +00:00
return c0;
2026-07-20 16:05:17 +00:00
}
function updateFromServerThread(id) {
2026-10-03 08:58:59 +00:00
let memberCount;
let memberIdsPreview;
2026-07-20 16:05:17 +00:00
if (null != id) {
2026-10-03 08:58:59 +00:00
if (!(id.id in closure_4)) {
const channel = ChannelStore.getChannel(id.id);
2026-07-20 16:05:17 +00:00
if (null != channel) {
2026-07-29 08:29:29 +00:00
if (ALL_CHANNEL_TYPES.has(channel.type)) {
2026-10-03 08:58:59 +00:00
if (!(channel.id in closure_4)) {
const obj = { guildId: null, parentId: null, memberCount, memberIdsPreview };
({ guild_id: obj.guildId, parent_id: obj.parentId, memberCount } = channel);
2026-10-03 08:58:59 +00:00
id = channel.id;
const tmp4 = closure_4;
2026-07-29 08:29:29 +00:00
if (memberCount == null) {
memberCount = 0;
}
2026-10-03 08:58:59 +00:00
memberIdsPreview = channel.memberIdsPreview;
2026-07-29 08:29:29 +00:00
if (memberIdsPreview == null) {
memberIdsPreview = [];
}
2026-10-03 08:58:59 +00:00
tmp4[id] = obj;
2026-07-29 08:29:29 +00:00
}
if (null != channel.memberCount) {
2026-10-03 08:58:59 +00:00
closure_4[channel.id].memberCount = channel.memberCount;
2026-07-29 08:29:29 +00:00
}
if (null != channel.memberIdsPreview) {
2026-10-03 08:58:59 +00:00
closure_4[channel.id].memberIdsPreview = channel.memberIdsPreview;
2026-07-29 08:29:29 +00:00
}
}
2026-07-20 16:05:17 +00:00
return true;
}
}
}
return false;
}
const ALL_CHANNEL_TYPES = ChannelRecord.ALL_CHANNEL_TYPES;
2026-10-03 08:58:59 +00:00
const React3 = {};
const Store = get_initializedDefault.Store;
2026-07-29 08:29:29 +00:00
class ThreadMembersStore extends Store {
2026-10-03 08:58:59 +00:00
initialize() {
this.waitFor(ChannelStore);
2026-07-20 16:05:17 +00:00
}
2026-10-03 08:58:59 +00:00
getMemberCount(arg0) {
let memberCount;
if (closure_4[arg0] != null) {
memberCount = tmp.memberCount;
}
if (memberCount == null) {
memberCount = null;
}
return memberCount;
2026-07-29 08:29:29 +00:00
}
2026-10-03 08:58:59 +00:00
getMemberIdsPreview(arg0) {
let memberIdsPreview;
if (closure_4[arg0] != null) {
memberIdsPreview = tmp.memberIdsPreview;
}
if (memberIdsPreview == null) {
memberIdsPreview = null;
}
return memberIdsPreview;
2026-07-29 08:29:29 +00:00
}
2026-10-03 08:58:59 +00:00
getInitialOverlayState() {
return closure_4;
2026-07-29 08:29:29 +00:00
}
2026-10-03 08:58:59 +00:00
}
const prototype = ThreadMembersStore.prototype;
2026-07-29 08:29:29 +00:00
ThreadMembersStore.displayName = "ThreadMembersStore";
2026-10-03 08:58:59 +00:00
let obj = {
2026-07-20 16:05:17 +00:00
CONNECTION_OPEN: function handleConnectionOpen(guilds) {
2026-08-24 06:08:38 +00:00
closure_4 = {};
2026-07-20 16:05:17 +00:00
guilds = guilds.guilds;
const item = guilds.forEach(updateFromGuild);
},
OVERLAY_INITIALIZE: function handleOverlayInitialize(threadMembers) {
2026-10-03 08:58:59 +00:00
const obj = {};
2026-07-20 16:05:17 +00:00
const merged = Object.assign(threadMembers.threadMembers);
2026-10-03 08:58:59 +00:00
closure_4 = obj;
2026-07-20 16:05:17 +00:00
},
GUILD_CREATE: function handleGuildCreate(guild) {
2026-07-29 08:29:29 +00:00
const threads = guild.guild.threads;
if (threads != null) {
const item = threads.forEach(updateFromThread);
}
2026-07-20 16:05:17 +00:00
},
GUILD_DELETE: function handleGuildDelete(guild) {
2026-07-29 08:29:29 +00:00
const id = guild.guild.id;
2026-10-03 08:58:59 +00:00
const obj = _modDef12;
closure_4 = obj.omitBy(closure_4, (guildId) => guildId.guildId === id);
2026-07-20 16:05:17 +00:00
},
CHANNEL_DELETE: function handleChannelDelete(channel) {
2026-07-29 08:29:29 +00:00
const id = channel.channel.id;
2026-10-03 08:58:59 +00:00
const obj = _modDef12;
closure_4 = obj.omitBy(closure_4, (parentId) => parentId.parentId === id);
2026-07-20 16:05:17 +00:00
},
THREAD_CREATE: handleThreadCreateOrUpdate,
THREAD_UPDATE: handleThreadCreateOrUpdate,
THREAD_LIST_SYNC: function handleThreadListSync(threads) {
threads = threads.threads;
const item = threads.forEach(updateFromThread);
},
THREAD_MEMBERS_UPDATE: function handleThreadMembersUpdate(memberIdsPreview) {
2026-10-03 08:58:59 +00:00
if (null == closure_4[memberIdsPreview.id]) {
2026-07-20 16:05:17 +00:00
return false;
} else {
if (null != memberIdsPreview.memberIdsPreview) {
2026-10-03 08:58:59 +00:00
closure_4[memberIdsPreview.id].memberIdsPreview = memberIdsPreview.memberIdsPreview;
2026-07-20 16:05:17 +00:00
}
2026-10-03 08:58:59 +00:00
closure_4[memberIdsPreview.id].memberCount = memberIdsPreview.memberCount;
2026-07-20 16:05:17 +00:00
}
},
SEARCH_MESSAGES_SUCCESS: handleSearchMessagesSuccess,
MOD_VIEW_SEARCH_MESSAGES_SUCCESS: handleSearchMessagesSuccess,
LOAD_THREADS_SUCCESS: handleLoadArchivedThreadsSuccess,
LOAD_ARCHIVED_THREADS_SUCCESS: handleLoadArchivedThreadsSuccess,
THREAD_DELETE: function handleThreadDelete(arg0) {
2026-10-03 08:58:59 +00:00
delete closure_4[arg0.channel.id];
2026-07-20 16:05:17 +00:00
},
2026-10-03 08:58:59 +00:00
LOAD_MESSAGES_SUCCESS: function handleLoadMessagesSuccess(messages) {
2026-07-20 16:05:17 +00:00
let flag = false;
2026-10-03 08:58:59 +00:00
messages = messages.messages;
for (const item10007 of messages) {
let tmp2 = updateFromServerThread(item10007.thread) || flag;
flag = tmp2;
2026-07-29 08:29:29 +00:00
continue;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
return flag;
2026-07-20 16:05:17 +00:00
}
2026-10-03 08:58:59 +00:00
};
const threadMembersStore = new ThreadMembersStore(DispatcherDefault, obj);
const result = size.fileFinishedImporting("modules/threads/ThreadMembersStore.tsx");
2026-07-20 16:05:17 +00:00
2026-07-29 08:29:29 +00:00
export default threadMembersStore;