From e7b8d59a7e41ebc46f93803f8bbc5e0d4a5d4a69 Mon Sep 17 00:00:00 2001 From: Vitor Pamplona Date: Wed, 30 Sep 2026 09:45:11 -0400 Subject: [PATCH] fix(concord): rank community members first in @-mention suggestions The composer only put people who had already posted in the channel first, so a member who hadn't posted there sank below strangers, especially ones whose NIP-05 starts with the typed prefix. "@Armada" never offered Armada Tester in RK Test #general. The priority set is now the community roster (guestbook, role holders, owner, observed authors, minus banned and departed) plus the channel's authors. Verified on the emulator: "@Amy" puts Amy CLI Tester first in a community amy belongs to, and not in one they don't. Co-Authored-By: Claude Opus 5.5 --- .../send/ConcordNewMessageViewModel.kt | 28 ++++++++++++------- 1 file changed, 18 insertions(+), 10 deletions(-) diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/chats/publicChannels/concord/send/ConcordNewMessageViewModel.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/chats/publicChannels/concord/send/ConcordNewMessageViewModel.kt index aa5cf9c9fb..28a39441dd 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/chats/publicChannels/concord/send/ConcordNewMessageViewModel.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/chats/publicChannels/concord/send/ConcordNewMessageViewModel.kt @@ -92,8 +92,9 @@ open class ConcordNewMessageViewModel : ViewModel() { UserSuggestionState( accountVM.account, accountVM.nip05ClientBuilder(), - // Rank people who have posted in this channel first. - priorityPubkeys = { channelAuthors() }, + // Rank the community's members first, then anyone who posted in this channel: a + // member who never posted here otherwise sank below strangers with a matching NIP-05. + priorityPubkeys = { mentionPriority() }, ) this.emojiSuggestions?.reset() @@ -106,15 +107,22 @@ open class ConcordNewMessageViewModel : ViewModel() { uploadState?.load(media) } - private fun channelAuthors(): Set { + private fun mentionPriority(): Set { val community = communityId ?: return emptySet() - val channel = channelId ?: return emptySet() - return LocalCache - .getConcordChannelIfExists(ConcordChannelId(community, channel)) - ?.notes - ?.mapNotNull { _, note -> note.author?.pubkeyHex } - ?.toSet() - ?: emptySet() + val members = + account.concordSessions + .sessionFor(community) + ?.allMembers() + .orEmpty() + val channel = channelId ?: return members + val authors = + LocalCache + .getConcordChannelIfExists(ConcordChannelId(community, channel)) + ?.notes + ?.mapNotNull { _, note -> note.author?.pubkeyHex } + ?.toSet() + .orEmpty() + return members + authors } open fun load(