@@ -2,12 +2,10 @@ import 'dart:convert';
22
33import 'package:flutter/material.dart' ;
44
5- import '../api/model/initial_snapshot.dart' ;
65import '../api/model/model.dart' ;
76import '../generated/l10n/zulip_localizations.dart' ;
87import '../model/content.dart' ;
98import '../model/narrow.dart' ;
10- import '../model/store.dart' ;
119import 'app_bar.dart' ;
1210import 'content.dart' ;
1311import 'message_list.dart' ;
@@ -36,32 +34,6 @@ class ProfilePage extends StatelessWidget {
3634 page: ProfilePage (userId: userId));
3735 }
3836
39- /// The given user's real email address, if known, for displaying in the UI.
40- ///
41- /// Returns null if self-user isn't able to see [user] 's real email address.
42- String ? _getDisplayEmailFor (User user, {required PerAccountStore store}) {
43- if (store.account.zulipFeatureLevel >= 163 ) { // TODO(server-7)
44- // A non-null value means self-user has access to [user]'s real email,
45- // while a null value means it doesn't have access to the email.
46- // Search for "delivery_email" in https://zulip.com/api/register-queue.
47- return user.deliveryEmail;
48- } else {
49- if (user.deliveryEmail != null ) {
50- // A non-null value means self-user has access to [user]'s real email,
51- // while a null value doesn't necessarily mean it doesn't have access
52- // to the email, ....
53- return user.deliveryEmail;
54- } else if (store.emailAddressVisibility == EmailAddressVisibility .everyone) {
55- // ... we have to also check for [PerAccountStore.emailAddressVisibility].
56- // See:
57- // * https://github.com/zulip/zulip-mobile/pull/5515#discussion_r997731727
58- // * https://chat.zulip.org/#narrow/stream/378-api-design/topic/email.20address.20visibility/near/1296133
59- return user.email;
60- } else {
61- return null ;
62- }
63- }
64- }
6537
6638 @override
6739 Widget build (BuildContext context) {
@@ -72,7 +44,7 @@ class ProfilePage extends StatelessWidget {
7244 return const _ProfileErrorPage ();
7345 }
7446
75- final displayEmail = _getDisplayEmailFor (user, store: store);
47+ final displayEmail = store. userDisplayEmail (user, store: store);
7648 final items = [
7749 Center (
7850 child: Avatar (userId: userId, size: 200 , borderRadius: 200 / 8 )),
0 commit comments