Fix user autocomplete not showing users not in channel (#7980) (#7985)

This commit is contained in:
Mattermost Build 2024-06-01 00:29:11 +03:00 committed by GitHub
parent 91910693af
commit 765ee984ac
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -298,8 +298,14 @@ const AtMention = ({
if (outOfChannel?.length) {
const outChannelMemberIds = outOfChannel.map((e) => e.id);
// This only get us the users we have on the database.
// We need to append those users from which we don't have
// information at the end of the list.
const outSortedMembers = await getUsersFromDMSorted(database, outChannelMemberIds);
sortedMembers.push(...outSortedMembers);
const idSet = new Set(outSortedMembers.map((v) => v.id));
const outRest = outOfChannel.filter((v) => !idSet.has(v.id));
sortedMembers.push(...outSortedMembers, ...outRest);
}
if (hasTrailingSpaces(term)) {