Skip to content

Commit 23413ab

Browse files
committed
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 cdb2dd2 commit 23413ab

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
@@ -858,9 +858,10 @@ class _FixedDestinationContentInput extends StatelessWidget {
858858

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

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

lib/widgets/profile.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ class ProfilePage extends StatelessWidget {
4949
Center(
5050
child: Avatar(userId: userId, size: 200, borderRadius: 200 / 8)),
5151
const SizedBox(height: 16),
52-
Text(user.fullName,
52+
Text(store.userDisplayName(userId),
5353
textAlign: TextAlign.center,
5454
style: _TextStyles.primaryFieldText
5555
.merge(weightVariableTextStyle(context, wght: 700))),
@@ -75,7 +75,7 @@ class ProfilePage extends StatelessWidget {
7575
];
7676

7777
return Scaffold(
78-
appBar: ZulipAppBar(title: Text(user.fullName)),
78+
appBar: ZulipAppBar(title: Text(store.userDisplayName(userId))),
7979
body: SingleChildScrollView(
8080
child: Center(
8181
child: ConstrainedBox(

0 commit comments

Comments
 (0)