mirror of
https://github.com/vitorpamplona/amethyst.git
synced 2026-10-05 19:28:25 +00:00
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 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
c994027863
commit
e7b8d59a7e
+18
-10
@@ -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<HexKey> {
|
||||
private fun mentionPriority(): Set<HexKey> {
|
||||
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(
|
||||
|
||||
Reference in New Issue
Block a user