Skip to content

Commit 0b4751d

Browse files
chrisbobbegnprice
authored andcommitted
users [nfc]: Use userDisplayName at last non-self-user sites in widgets/
We've now centralized on store.userDisplayName and store.senderDisplayName for all the code that's responsible for showing a user's name on the screen, except for a few places we use `User.fullName` for (a) the self-user and (b) to create an @-mention for the compose box. The "(unknown user)" and upcoming "Muted user" placeholders aren't needed for (a) or (b).
1 parent 2ef4070 commit 0b4751d

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

lib/widgets/compose_box.dart

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -859,9 +859,10 @@ class _FixedDestinationContentInput extends StatelessWidget {
859859

860860
case DmNarrow(otherRecipientIds: [final otherUserId]):
861861
final store = PerAccountStoreWidget.of(context);
862-
final fullName = store.getUser(otherUserId)?.fullName;
863-
if (fullName == null) return zulipLocalizations.composeBoxGenericContentHint;
864-
return zulipLocalizations.composeBoxDmContentHint(fullName);
862+
final user = store.getUser(otherUserId);
863+
if (user == null) return zulipLocalizations.composeBoxGenericContentHint;
864+
return zulipLocalizations.composeBoxDmContentHint(
865+
store.userDisplayName(otherUserId));
865866

866867
case DmNarrow(): // A group DM thread.
867868
return zulipLocalizations.composeBoxGroupDmContentHint;

lib/widgets/profile.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ class ProfilePage extends StatelessWidget {
6565
fontSize: nameStyle.fontSize!,
6666
textScaler: MediaQuery.textScalerOf(context),
6767
),
68-
TextSpan(text: user.fullName),
68+
TextSpan(text: store.userDisplayName(userId)),
6969
]),
7070
textAlign: TextAlign.center,
7171
style: nameStyle),
@@ -91,7 +91,7 @@ class ProfilePage extends StatelessWidget {
9191
];
9292

9393
return Scaffold(
94-
appBar: ZulipAppBar(title: Text(user.fullName)),
94+
appBar: ZulipAppBar(title: Text(store.userDisplayName(userId))),
9595
body: SingleChildScrollView(
9696
child: Center(
9797
child: ConstrainedBox(

0 commit comments

Comments
 (0)