Skip to content

Commit a89d96e

Browse files
chrisbobbegnprice
authored andcommitted
user [nfc]: Inline store.userDisplayEmail, which has become trivial
For #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 0900820 commit a89d96e

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
@@ -56,7 +56,7 @@ class ProfilePage extends StatelessWidget {
5656
.merge(weightVariableTextStyle(context, wght: 700));
5757

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

0 commit comments

Comments
 (0)