fix(search): suggest yourself in DM from: and mentions: filters (#2854)

This commit is contained in:
Hampus authored and GitHub committed 2026-09-20 01:24:43 +02:00
1 parent e2abfd476a
commit 5d85e88532
2 files changed
+28 -7

No files matched your search

@@ -396,13 +396,23 @@ export function useMessageSearchAutocomplete({
if (plan.mode !== 'none') {
return memberSearchResults.slice(0, limit);
}
if (channel) {
const users = channel.recipientIds.map((id) => Users.getUser(id)).filter((u): u is User => u != null);
return matchSorter(users, searchTerm, {
keys: ['username', 'tag'],
}).slice(0, limit);
const usersById = new Map<string, User>();
const currentUser = Users.getCurrentUser();
if (currentUser) {
usersById.set(currentUser.id, currentUser);
}
return [];
for (const recipientId of channel?.recipientIds ?? []) {
const user = Users.getUser(recipientId);
if (user) {
usersById.set(user.id, user);
}
}
if (usersById.size === 0) {
return [];
}
return matchSorter(Array.from(usersById.values()), searchTerm, {
keys: ['username', 'tag'],
}).slice(0, limit);
},
[activeScope, currentGuildIdForScope, memberSearchResults, channel],
);