From c1f952d38de6de5524e8171e857db3e8bb0189dc Mon Sep 17 00:00:00 2001 From: Micah Morrison Date: Mon, 8 Jan 2024 22:07:23 -0500 Subject: [PATCH] Prioritize favorites in empty community prompt --- lib/shared/input_dialogs.dart | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/shared/input_dialogs.dart b/lib/shared/input_dialogs.dart index 08a1aa233..b28e4c9c2 100644 --- a/lib/shared/input_dialogs.dart +++ b/lib/shared/input_dialogs.dart @@ -106,8 +106,9 @@ Widget buildUserSuggestionWidget(BuildContext context, PersonView payload, {void /// Shows a dialog which allows typing/search for a community void showCommunityInputDialog(BuildContext context, {required String title, required void Function(CommunityView) onCommunitySelected, Iterable? emptySuggestions}) async { try { - emptySuggestions ??= context.read().state.subsciptions; - // TODO sort + final AccountState accountState = context.read().state; + emptySuggestions ??= accountState.subsciptions; + emptySuggestions = prioritizeFavorites(emptySuggestions.toList(), accountState.favorites); } catch (e) { // If we can't read the AccountBloc here, for whatever reason, it's ok. No need for subscriptions. }