-
Notifications
You must be signed in to change notification settings - Fork 315
Mute muted users (Chris's revision, 1 of 2) #1560
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
c4a0ad9
users: Have userDisplayEmail handle unknown users
chrisbobbe cf857e0
lightbox: Use senderDisplayName for sender's name
chrisbobbe 2ef4070
compose: Fix error on quote-and-replying message from unknown sender
chrisbobbe 0b4751d
users [nfc]: Use userDisplayName at last non-self-user sites in widgets/
chrisbobbe d93f61a
muted-users: Say "Muted user" to replace a user's name, where applicable
chrisbobbe 8b01b47
theme [nfc]: Rename some variables that aren't named variables in Figma
chrisbobbe 86137cd
muted-users: Use placeholder for avatars of muted users, where applic…
chrisbobbe e672a29
msglist [nfc]: Remove a no-op MainAxisAlignment.spaceBetween in _Send…
chrisbobbe cd65877
button [nfc]: Have ZulipWebUiKitButton support a smaller, ad hoc size
chrisbobbe 17294ee
button [nfc]: Have ZulipWebUiKitButton support an icon
chrisbobbe 2ca3015
button [nfc]: Have ZulipWebUiKitButton support ad hoc minimal-neutral…
chrisbobbe b509c24
msglist: Hide content of muted messages, with a "Reveal message" button
chrisbobbe File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -44,27 +44,40 @@ mixin UserStore on PerAccountStoreBase { | |
|
||
/// The name to show the given user as in the UI, even for unknown users. | ||
/// | ||
/// This is the user's [User.fullName] if the user is known, | ||
/// and otherwise a translation of "(unknown user)". | ||
/// If the user is muted and [replaceIfMuted] is true (the default), | ||
/// this is [ZulipLocalizations.mutedUser]. | ||
/// | ||
/// Otherwise this is the user's [User.fullName] if the user is known, | ||
/// or (if unknown) [ZulipLocalizations.unknownUserName]. | ||
/// | ||
/// When a [Message] is available which the user sent, | ||
/// use [senderDisplayName] instead for a better-informed fallback. | ||
String userDisplayName(int userId) { | ||
String userDisplayName(int userId, {bool replaceIfMuted = true}) { | ||
if (replaceIfMuted && isUserMuted(userId)) { | ||
return GlobalLocalizations.zulipLocalizations.mutedUser; | ||
} | ||
Comment on lines
-52
to
+58
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Cool, I like this structure. The inventory of where we say "Muted user" and where we don't is also helpful:
|
||
return getUser(userId)?.fullName | ||
?? GlobalLocalizations.zulipLocalizations.unknownUserName; | ||
} | ||
|
||
/// The name to show for the given message's sender in the UI. | ||
/// | ||
/// If the user is known (see [getUser]), this is their current [User.fullName]. | ||
/// If the sender is muted and [replaceIfMuted] is true (the default), | ||
/// this is [ZulipLocalizations.mutedUser]. | ||
/// | ||
/// Otherwise, if the user is known (see [getUser]), | ||
/// this is their current [User.fullName]. | ||
/// If unknown, this uses the fallback value conveniently provided on the | ||
/// [Message] object itself, namely [Message.senderFullName]. | ||
/// | ||
/// For a user who isn't the sender of some known message, | ||
/// see [userDisplayName]. | ||
String senderDisplayName(Message message) { | ||
return getUser(message.senderId)?.fullName | ||
?? message.senderFullName; | ||
String senderDisplayName(Message message, {bool replaceIfMuted = true}) { | ||
final senderId = message.senderId; | ||
if (replaceIfMuted && isUserMuted(senderId)) { | ||
return GlobalLocalizations.zulipLocalizations.mutedUser; | ||
} | ||
return getUser(senderId)?.fullName ?? message.senderFullName; | ||
} | ||
|
||
/// Whether the user with [userId] is muted by the self-user. | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this comment is still relevant for explaining a choice we made about how this logic works.
(The name
mention
needs updating, though — already did, to sayuserMention
.)