decord/source/stores/InviteSuggestionsStore.tsx

149 lines
5.3 KiB
TypeScript
Raw Normal View History

// Module ID: 9838
// Function ID: 9839
2026-09-03 10:05:34 +00:00
// Name: compareRowsByMatchScore
// Dependencies: [9839, 7659, 1957, 4199, 4209, 1074, 7736, 9827, 5518, 1369, 504, 573, 2]
2026-07-20 16:05:17 +00:00
// Module 9838 (compareRowsByMatchScore)
import initializeDefault from "initialize" /* 504 */;
import dispatcherDefault from "dispatcher" /* 573 */;
import sortByMatchScoreDefault from "sortByMatchScore" /* 5518 */;
import isGuildMember from "isGuildMember" /* 9827 */;
import closure_9 from "handleConnectionOpen" /* 9839 */;
import closure_10 from "recomputeAffinities" /* 7659 */;
import closure_11 from "ensureGuildLoaded" /* 1957 */;
import closure_12 from "getUncachedChannelPermissions" /* 4199 */;
import closure_13 from "markAllUserIdListsStale" /* 4209 */;
import ME from "ME" /* 1074 */;
import { InviteTargetTypes } from "InviteSendStates" /* 7736 */;
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-09-03 10:05:34 +00:00
function compareRowsByMatchScore(score, score2) {
let num = 0;
if (null != score.score) {
num = 0;
if (null != score2.score) {
let obj = { score: null };
obj[0] = score.score;
obj = { score: null };
obj[0] = score2.score;
num = sortByMatchScoreDefault(obj, obj);
}
}
return num;
}
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) {
2026-09-03 10:05:34 +00:00
tmp = closure_8 === 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;
}
const mostRecentDMedUser = set1(9827).getMostRecentDMedUser(set, id);
2026-07-20 16:05:17 +00:00
let isBlockedOrIgnoredResult = null == mostRecentDMedUser;
if (!isBlockedOrIgnoredResult) {
2026-09-03 10:05:34 +00:00
isBlockedOrIgnoredResult = closure_13.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-09-03 10:05:34 +00:00
if (closure_8 === 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));
const found = mapped.filter(set1(1369).isNotNullish);
2026-07-29 08:29:29 +00:00
const found1 = found.filter((type) => type.type === constants.GUILD_TEXT);
2026-09-03 10:05:34 +00:00
const found2 = found1.filter((arg0) => closure_12.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));
}
const obj2 = set1(9827);
return set1(9827).generateRowsForQuery({ query, omitUserIds: set, suggestedUserIds: set, maxRowsWithoutQuery: 100, omitGuildId: id, suggestedChannelIds: set1, inviteTargetType: closure_8 });
2026-07-20 16:05:17 +00:00
}
2026-09-03 10:05:34 +00:00
({ ChannelTypes: closure_14, Permissions: closure_15 } = ME);
2026-07-23 10:11:24 +00:00
let set = new Set();
2026-09-03 10:05:34 +00:00
let closure_18 = [];
2026-07-23 10:11:24 +00:00
let map = new Map();
2026-09-03 10:05:34 +00:00
let closure_20 = { 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-09-03 10:05:34 +00:00
this.waitFor(closure_11, closure_12, closure_9, closure_13, closure_10);
2026-07-29 08:29:29 +00:00
};
prototype["getInviteSuggestionRows"] = function getInviteSuggestionRows() {
2026-09-03 10:05:34 +00:00
return closure_18;
2026-07-29 08:29:29 +00:00
};
prototype["getTotalSuggestionsCount"] = function getTotalSuggestionsCount() {
2026-09-03 10:05:34 +00:00
return closure_3;
2026-07-29 08:29:29 +00:00
};
prototype["getInitialCounts"] = function getInitialCounts() {
2026-09-03 10:05:34 +00:00
return closure_20;
2026-07-29 08:29:29 +00:00
};
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;
2026-09-03 10:05:34 +00:00
obj[4] = closure_4;
2026-07-29 08:29:29 +00:00
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-09-03 10:05:34 +00:00
const blockedOrIgnoredIDs = closure_13.getBlockedOrIgnoredIDs();
2026-08-24 06:08:38 +00:00
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);
2026-09-03 10:05:34 +00:00
c4 = 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-09-03 10:05:34 +00:00
closure_4 = "" !== query;
2026-07-20 16:05:17 +00:00
const rows = _computeRows(query).rows;
2026-09-03 10:05:34 +00:00
const sorted = rows.sort(compareRowsByMatchScore);
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;