Skip to content

Commit 15cd08a

Browse files
committed
store [nfc]: Inline store.userDisplayEmail, which has become trivial
For zulip#236 matching users by email address, we'd like to add some fields to AutocompleteDataCache, and that'll be simpler if we don't have to involve the whole UserStore.
1 parent 3a226c6 commit 15cd08a

File tree

3 files changed

+2
-8
lines changed

3 files changed

+2
-8
lines changed

lib/model/user.dart

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -91,12 +91,6 @@ mixin UserStore on PerAccountStoreBase, RealmStore {
9191
return getUser(senderId)?.fullName ?? message.senderFullName;
9292
}
9393

94-
/// The user's real email address, if known, for displaying in the UI.
95-
///
96-
/// Returns null if self-user isn't able to see the user's real email address,
97-
/// or if the user isn't actually a user we know about.
98-
String? userDisplayEmail(int userId) => getUser(userId)?.deliveryEmail;
99-
10094
/// Whether [user] has passed the realm's waiting period to be a full member.
10195
///
10296
/// See:

lib/widgets/autocomplete.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -285,7 +285,7 @@ class MentionAutocompleteItem extends StatelessWidget {
285285
label = store.userDisplayName(userId);
286286
emoji = UserStatusEmoji(userId: userId, size: 18,
287287
padding: const EdgeInsetsDirectional.only(start: 5.0));
288-
sublabel = store.userDisplayEmail(userId);
288+
sublabel = store.getUser(userId)?.deliveryEmail;
289289
case WildcardMentionAutocompleteResult(:var wildcardOption):
290290
avatar = SizedBox.square(dimension: 36,
291291
child: const Icon(ZulipIcons.three_person, size: 24));

lib/widgets/profile.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ class ProfilePage extends StatelessWidget {
5454
.merge(weightVariableTextStyle(context, wght: 700));
5555

5656
final userStatus = store.getUserStatus(userId);
57-
final displayEmail = store.userDisplayEmail(userId);
57+
final displayEmail = user.deliveryEmail;
5858
final items = [
5959
Center(
6060
child: Avatar(

0 commit comments

Comments
 (0)