Skip to content

Commit 78b0bb1

Browse files
committed
autocomplete: Sort user-mention autocomplete results
In @-mention autocomplete, users are suggested based on: 1. Recent activity in the current stream. 2. Recent DM conversations. 3. Human vs. Bot users. 4. Alphabetical order. Fixes: #228
1 parent fdef8a9 commit 78b0bb1

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

lib/model/autocomplete.dart

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -295,7 +295,12 @@ class MentionAutocompleteView extends ChangeNotifier {
295295
} else if (userA.isBot && !userB.isBot) {
296296
return 1;
297297
}
298-
return 0;
298+
299+
final userAName = store.autocompleteViewManager.autocompleteDataCache
300+
.normalizedNameForUser(userA);
301+
final userBName = store.autocompleteViewManager.autocompleteDataCache
302+
.normalizedNameForUser(userB);
303+
return userAName.compareTo(userBName);
299304
}
300305

301306
List<User> sortByRelevance({

0 commit comments

Comments
 (0)