Skip to content

Commit 72c49aa

Browse files
committed
Removed sorting in autoCompleteState, added comment
1 parent a3cf235 commit 72c49aa

File tree

1 file changed

+3
-7
lines changed

1 file changed

+3
-7
lines changed

app/src/main/java/org/thoughtcrime/securesms/conversation/v2/mention/MentionViewModel.kt

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -188,6 +188,8 @@ class MentionViewModel(
188188
// For communities and one-on-one conversations
189189
val contacts = contactDatabase.getContacts(memberIDs) // Get members from contacts based on memberIDs
190190
val contactMap = contacts.associateBy { it.accountID }
191+
192+
// Map using memberIDs to preserve the order of members
191193
memberIDs.asSequence()
192194
.filter { it != myId }
193195
.mapNotNull { contactMap[it] }
@@ -230,7 +232,6 @@ class MentionViewModel(
230232
}
231233
}
232234

233-
filtered.sortWith(Candidate.MENTION_LIST_COMPARATOR)
234235
AutoCompleteState.Result(filtered, query.query)
235236
}
236237
}
@@ -346,12 +347,7 @@ class MentionViewModel(
346347
val nameHighlighted: CharSequence,
347348
// The score of matching the query keyword. Lower is better.
348349
val matchScore: Int,
349-
) {
350-
companion object {
351-
val MENTION_LIST_COMPARATOR = compareBy<Candidate> { !it.member.isMe }
352-
.thenBy { it.matchScore }
353-
}
354-
}
350+
)
355351

356352
sealed interface AutoCompleteState {
357353
object Idle : AutoCompleteState

0 commit comments

Comments
 (0)