Skip to content

Commit

Permalink
Prioritize favorites in empty community prompt
Browse files Browse the repository at this point in the history
  • Loading branch information
micahmo committed Jan 9, 2024
1 parent 2684214 commit c1f952d
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions lib/shared/input_dialogs.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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<CommunityView>? emptySuggestions}) async {
try {
emptySuggestions ??= context.read<AccountBloc>().state.subsciptions;
// TODO sort
final AccountState accountState = context.read<AccountBloc>().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.
}
Expand Down

0 comments on commit c1f952d

Please sign in to comment.