decord/source/stores/InviteSuggestionsStore.tsx

143 lines
5.1 KiB
TypeScript
Raw Normal View History

2026-08-25 06:04:03 +00:00
// Module ID: 9226
// Function ID: 9227
2026-07-29 08:29:29 +00:00
// Name: _computeRows
2026-08-25 06:04:03 +00:00
// Dependencies: [7451, 7265, 1391, 4025, 4034, 676, 7340, 9214, 1370, 589, 709, 2]
2026-07-20 16:05:17 +00:00
2026-08-25 06:04:03 +00:00
// Module 9226 (_computeRows)
2026-08-24 06:08:38 +00:00
import initializeDefault from "initialize" /* 589 */;
import dispatcherDefault from "dispatcher" /* 709 */;
2026-08-25 06:04:03 +00:00
import isGuildMember from "isGuildMember" /* 9214 */;
import closure_8 from "handleConnectionOpen" /* 7451 */;
import closure_9 from "recomputeAffinities" /* 7265 */;
2026-08-24 06:08:38 +00:00
import closure_10 from "ensureGuildLoaded" /* 1391 */;
2026-08-25 06:04:03 +00:00
import closure_11 from "getUncachedChannelPermissions" /* 4025 */;
import closure_12 from "markAllUserIdListsStale" /* 4034 */;
2026-08-24 06:08:38 +00:00
import ME from "ME" /* 676 */;
2026-08-25 06:04:03 +00:00
import { InviteTargetTypes } from "InviteSendStates" /* 7340 */;
2026-08-24 06:08:38 +00:00
import set from "set" /* 2 */;
2026-07-23 10:11:24 +00:00
2026-08-24 06:08:38 +00:00
require = arg1;
2026-07-20 16:05:17 +00:00
function _computeRows(query) {
2026-08-24 06:08:38 +00:00
set = new Set();
2026-07-29 08:29:29 +00:00
if (type != null) {
2026-07-20 16:05:17 +00:00
type = type.type;
}
2026-07-29 08:29:29 +00:00
let tmp = null == id;
if (!tmp) {
tmp = closure_7 === InviteTargetTypes.EMBEDDED_APPLICATION;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
if (!tmp) {
tmp = type === constants.GUILD_VOICE;
2026-07-20 16:05:17 +00:00
}
2026-07-23 10:11:24 +00:00
id = null;
2026-07-29 08:29:29 +00:00
if (!tmp) {
2026-07-20 16:05:17 +00:00
id = id.id;
}
2026-08-25 06:04:03 +00:00
const mostRecentDMedUser = set1(9214).getMostRecentDMedUser(set, id);
2026-07-20 16:05:17 +00:00
let isBlockedOrIgnoredResult = null == mostRecentDMedUser;
if (!isBlockedOrIgnoredResult) {
2026-08-24 06:08:38 +00:00
isBlockedOrIgnoredResult = closure_12.isBlockedOrIgnored(mostRecentDMedUser.id);
2026-07-20 16:05:17 +00:00
}
if (!isBlockedOrIgnoredResult) {
set.add(mostRecentDMedUser.id);
}
2026-07-29 08:29:29 +00:00
const userAffinities = authStore.getUserAffinities();
for (const item10040 of userAffinities) {
let addResult1 = set.add(item10040.otherUserId);
continue;
2026-07-20 16:05:17 +00:00
}
2026-07-23 10:11:24 +00:00
set1 = new Set();
2026-07-29 08:29:29 +00:00
if (closure_7 === InviteTargetTypes.EMBEDDED_APPLICATION) {
2026-07-23 10:11:24 +00:00
channelHistory = channelHistory.getChannelHistory();
2026-07-29 08:29:29 +00:00
const mapped = channelHistory.map((arg0) => channel.getChannel(arg0));
2026-08-11 06:20:06 +00:00
const found = mapped.filter(set1(1370).isNotNullish);
2026-07-29 08:29:29 +00:00
const found1 = found.filter((type) => type.type === constants.GUILD_TEXT);
2026-08-24 06:08:38 +00:00
const found2 = found1.filter((arg0) => closure_11.can(constants2.SEND_MESSAGES, arg0));
2026-07-20 16:05:17 +00:00
const substr = found2.slice(0, 3);
const item = substr.forEach((id) => set1.add(id.id));
}
2026-08-25 06:04:03 +00:00
const obj2 = set1(9214);
return set1(9214).generateRowsForQuery({ query, omitUserIds: set, suggestedUserIds: set, maxRowsWithoutQuery: 100, omitGuildId: id, suggestedChannelIds: set1, inviteTargetType: closure_7 });
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
({ ChannelTypes: map1, Permissions: closure_14 } = ME);
2026-07-23 10:11:24 +00:00
let set = new Set();
2026-07-29 08:29:29 +00:00
let closure_17 = [];
2026-07-23 10:11:24 +00:00
let map = new Map();
2026-07-29 08:29:29 +00:00
let closure_19 = { numFriends: 0, numDms: 0, numGroupDms: 0, numChannels: 0 };
2026-08-24 06:08:38 +00:00
const Store = initializeDefault.Store;
2026-07-29 08:29:29 +00:00
class InviteSuggestionsStore extends Store {
}
const prototype = InviteSuggestionsStore.prototype;
prototype["initialize"] = function initialize() {
2026-08-24 06:08:38 +00:00
this.waitFor(closure_10, closure_11, closure_8, closure_12, closure_9);
2026-07-29 08:29:29 +00:00
};
prototype["getInviteSuggestionRows"] = function getInviteSuggestionRows() {
return closure_17;
};
prototype["getTotalSuggestionsCount"] = function getTotalSuggestionsCount() {
return closure_2;
};
prototype["getInitialCounts"] = function getInitialCounts() {
return closure_19;
};
prototype["getSelectedInviteMetadata"] = function getSelectedInviteMetadata(isSuggested) {
const value = map.get(isSuggested);
const userAffinities = authStore.getUserAffinities();
if (null != value) {
const obj = { rowNum: null, isAffinitySuggestion: null, numTotal: null, numAffinityConnections: null, isFiltered: null };
obj[0] = value.index;
obj[1] = isSuggested.isSuggested;
obj[2] = length.length;
obj[3] = arr.length;
obj[4] = closure_3;
return obj;
}
};
InviteSuggestionsStore.displayName = "InviteSuggestionsStore";
2026-08-24 06:08:38 +00:00
const inviteSuggestionsStore = new InviteSuggestionsStore(dispatcherDefault, {
2026-07-20 16:05:17 +00:00
LOAD_INVITE_SUGGESTIONS: function refreshInviteSuggestions(guild) {
({ omitUserIds, channel, inviteTargetType } = guild);
guild = null;
if (null != channel) {
guild = guild.guild;
}
const applicationId = guild.applicationId;
2026-08-24 06:08:38 +00:00
const blockedOrIgnoredIDs = closure_12.getBlockedOrIgnoredIDs();
let obj = isGuildMember;
2026-07-20 16:05:17 +00:00
obj = { channel, applicationId, inviteTargetType };
const usersAlreadyJoined = obj.getUsersAlreadyJoined(obj);
const items = [...usersAlreadyJoined];
2026-08-24 06:08:38 +00:00
set = new Set(items);
c3 = false;
2026-07-20 16:05:17 +00:00
const tmp5 = _computeRows("");
2026-07-29 08:29:29 +00:00
const rows = tmp5.rows;
2026-08-24 06:08:38 +00:00
map = new Map();
2026-07-29 08:29:29 +00:00
const item = rows.forEach((arg0, index) => {
const result = map.set(arg0, { index });
});
2026-07-20 16:05:17 +00:00
const counts = tmp5.counts;
},
INVITE_SUGGESTIONS_SEARCH: function handleSearch(query) {
query = query.query;
2026-08-24 06:08:38 +00:00
closure_3 = "" !== query;
2026-07-20 16:05:17 +00:00
const rows = _computeRows(query).rows;
const sorted = rows.sort((score, score2) => {
let num = 0;
if (null != score.score) {
num = 0;
if (null != score2.score) {
num = score.score - score2.score;
}
}
return num;
});
2026-08-24 06:08:38 +00:00
map = new Map();
2026-07-29 08:29:29 +00:00
const item = rows.forEach((arg0, index) => {
const result = map.set(arg0, { index });
});
2026-07-20 16:05:17 +00:00
}
});
2026-07-23 10:11:24 +00:00
let result = set.fileFinishedImporting("stores/InviteSuggestionsStore.tsx");
2026-07-20 16:05:17 +00:00
2026-07-29 08:29:29 +00:00
export default inviteSuggestionsStore;