Skip to content

Commit 9530e32

Browse files
committed
msglist: Distinguish messages sent by muted senders
Figma design: https://www.figma.com/design/1JTNtYo9memgW7vV6d0ygq/Zulip-Mobile?node-id=6089-28385&t=28DdYiTs6fXWR9ua-0 Fixes: #296
1 parent 0c87e1f commit 9530e32

14 files changed

+326
-44
lines changed

assets/l10n/app_en.arb

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,10 @@
128128
"@actionSheetOptionMarkAsUnread": {
129129
"description": "Label for mark as unread button on action sheet."
130130
},
131+
"actionSheetOptionHideMutedMessage": "Hide muted message again",
132+
"@actionSheetOptionHideMutedMessage": {
133+
"description": "Label for hide muted message again button on action sheet."
134+
},
131135
"actionSheetOptionShare": "Share",
132136
"@actionSheetOptionShare": {
133137
"description": "Label for share button on action sheet."
@@ -872,6 +876,14 @@
872876
"@noEarlierMessages": {
873877
"description": "Text to show at the start of a message list if there are no earlier messages."
874878
},
879+
"mutedSender": "Muted sender",
880+
"@mutedSender": {
881+
"description": "Name for a muted user to display in message list."
882+
},
883+
"revealButtonLabel": "Reveal message for muted sender",
884+
"@revealButtonLabel": {
885+
"description": "Label for the button revealing hidden message from a muted sender in message list."
886+
},
875887
"scrollToBottomTooltip": "Scroll to bottom",
876888
"@scrollToBottomTooltip": {
877889
"description": "Tooltip for button to scroll to bottom."

lib/generated/l10n/zulip_localizations.dart

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -302,6 +302,12 @@ abstract class ZulipLocalizations {
302302
/// **'Mark as unread from here'**
303303
String get actionSheetOptionMarkAsUnread;
304304

305+
/// Label for hide muted message again button on action sheet.
306+
///
307+
/// In en, this message translates to:
308+
/// **'Hide muted message again'**
309+
String get actionSheetOptionHideMutedMessage;
310+
305311
/// Label for share button on action sheet.
306312
///
307313
/// In en, this message translates to:
@@ -1286,6 +1292,18 @@ abstract class ZulipLocalizations {
12861292
/// **'No earlier messages'**
12871293
String get noEarlierMessages;
12881294

1295+
/// Name for a muted user to display in message list.
1296+
///
1297+
/// In en, this message translates to:
1298+
/// **'Muted sender'**
1299+
String get mutedSender;
1300+
1301+
/// Label for the button revealing hidden message from a muted sender in message list.
1302+
///
1303+
/// In en, this message translates to:
1304+
/// **'Reveal message for muted sender'**
1305+
String get revealButtonLabel;
1306+
12891307
/// Tooltip for button to scroll to bottom.
12901308
///
12911309
/// In en, this message translates to:

lib/generated/l10n/zulip_localizations_ar.dart

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,9 @@ class ZulipLocalizationsAr extends ZulipLocalizations {
110110
@override
111111
String get actionSheetOptionMarkAsUnread => 'Mark as unread from here';
112112

113+
@override
114+
String get actionSheetOptionHideMutedMessage => 'Hide muted message again';
115+
113116
@override
114117
String get actionSheetOptionShare => 'Share';
115118

@@ -709,6 +712,12 @@ class ZulipLocalizationsAr extends ZulipLocalizations {
709712
@override
710713
String get noEarlierMessages => 'No earlier messages';
711714

715+
@override
716+
String get mutedSender => 'Muted sender';
717+
718+
@override
719+
String get revealButtonLabel => 'Reveal message for muted sender';
720+
712721
@override
713722
String get scrollToBottomTooltip => 'Scroll to bottom';
714723

lib/generated/l10n/zulip_localizations_en.dart

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,9 @@ class ZulipLocalizationsEn extends ZulipLocalizations {
110110
@override
111111
String get actionSheetOptionMarkAsUnread => 'Mark as unread from here';
112112

113+
@override
114+
String get actionSheetOptionHideMutedMessage => 'Hide muted message again';
115+
113116
@override
114117
String get actionSheetOptionShare => 'Share';
115118

@@ -709,6 +712,12 @@ class ZulipLocalizationsEn extends ZulipLocalizations {
709712
@override
710713
String get noEarlierMessages => 'No earlier messages';
711714

715+
@override
716+
String get mutedSender => 'Muted sender';
717+
718+
@override
719+
String get revealButtonLabel => 'Reveal message for muted sender';
720+
712721
@override
713722
String get scrollToBottomTooltip => 'Scroll to bottom';
714723

lib/generated/l10n/zulip_localizations_ja.dart

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,9 @@ class ZulipLocalizationsJa extends ZulipLocalizations {
110110
@override
111111
String get actionSheetOptionMarkAsUnread => 'Mark as unread from here';
112112

113+
@override
114+
String get actionSheetOptionHideMutedMessage => 'Hide muted message again';
115+
113116
@override
114117
String get actionSheetOptionShare => 'Share';
115118

@@ -709,6 +712,12 @@ class ZulipLocalizationsJa extends ZulipLocalizations {
709712
@override
710713
String get noEarlierMessages => 'No earlier messages';
711714

715+
@override
716+
String get mutedSender => 'Muted sender';
717+
718+
@override
719+
String get revealButtonLabel => 'Reveal message for muted sender';
720+
712721
@override
713722
String get scrollToBottomTooltip => 'Scroll to bottom';
714723

lib/generated/l10n/zulip_localizations_nb.dart

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,9 @@ class ZulipLocalizationsNb extends ZulipLocalizations {
110110
@override
111111
String get actionSheetOptionMarkAsUnread => 'Mark as unread from here';
112112

113+
@override
114+
String get actionSheetOptionHideMutedMessage => 'Hide muted message again';
115+
113116
@override
114117
String get actionSheetOptionShare => 'Share';
115118

@@ -709,6 +712,12 @@ class ZulipLocalizationsNb extends ZulipLocalizations {
709712
@override
710713
String get noEarlierMessages => 'No earlier messages';
711714

715+
@override
716+
String get mutedSender => 'Muted sender';
717+
718+
@override
719+
String get revealButtonLabel => 'Reveal message for muted sender';
720+
712721
@override
713722
String get scrollToBottomTooltip => 'Scroll to bottom';
714723

lib/generated/l10n/zulip_localizations_pl.dart

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,9 @@ class ZulipLocalizationsPl extends ZulipLocalizations {
115115
String get actionSheetOptionMarkAsUnread =>
116116
'Odtąd oznacz jako nieprzeczytane';
117117

118+
@override
119+
String get actionSheetOptionHideMutedMessage => 'Hide muted message again';
120+
118121
@override
119122
String get actionSheetOptionShare => 'Udostępnij';
120123

@@ -720,6 +723,12 @@ class ZulipLocalizationsPl extends ZulipLocalizations {
720723
@override
721724
String get noEarlierMessages => 'Brak historii';
722725

726+
@override
727+
String get mutedSender => 'Muted sender';
728+
729+
@override
730+
String get revealButtonLabel => 'Reveal message for muted sender';
731+
723732
@override
724733
String get scrollToBottomTooltip => 'Przewiń do dołu';
725734

lib/generated/l10n/zulip_localizations_ru.dart

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,9 @@ class ZulipLocalizationsRu extends ZulipLocalizations {
115115
String get actionSheetOptionMarkAsUnread =>
116116
'Отметить как непрочитанные начиная отсюда';
117117

118+
@override
119+
String get actionSheetOptionHideMutedMessage => 'Hide muted message again';
120+
118121
@override
119122
String get actionSheetOptionShare => 'Поделиться';
120123

@@ -723,6 +726,12 @@ class ZulipLocalizationsRu extends ZulipLocalizations {
723726
@override
724727
String get noEarlierMessages => 'Предшествующих сообщений нет';
725728

729+
@override
730+
String get mutedSender => 'Muted sender';
731+
732+
@override
733+
String get revealButtonLabel => 'Reveal message for muted sender';
734+
726735
@override
727736
String get scrollToBottomTooltip => 'Пролистать вниз';
728737

lib/generated/l10n/zulip_localizations_sk.dart

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,9 @@ class ZulipLocalizationsSk extends ZulipLocalizations {
111111
String get actionSheetOptionMarkAsUnread =>
112112
'Označiť ako neprečítané od tejto správy';
113113

114+
@override
115+
String get actionSheetOptionHideMutedMessage => 'Hide muted message again';
116+
114117
@override
115118
String get actionSheetOptionShare => 'Zdielať';
116119

@@ -711,6 +714,12 @@ class ZulipLocalizationsSk extends ZulipLocalizations {
711714
@override
712715
String get noEarlierMessages => 'No earlier messages';
713716

717+
@override
718+
String get mutedSender => 'Muted sender';
719+
720+
@override
721+
String get revealButtonLabel => 'Reveal message for muted sender';
722+
714723
@override
715724
String get scrollToBottomTooltip => 'Scroll to bottom';
716725

lib/generated/l10n/zulip_localizations_uk.dart

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,9 @@ class ZulipLocalizationsUk extends ZulipLocalizations {
115115
@override
116116
String get actionSheetOptionMarkAsUnread => 'Позначити як непрочитане звідси';
117117

118+
@override
119+
String get actionSheetOptionHideMutedMessage => 'Hide muted message again';
120+
118121
@override
119122
String get actionSheetOptionShare => 'Поширити';
120123

@@ -723,6 +726,12 @@ class ZulipLocalizationsUk extends ZulipLocalizations {
723726
@override
724727
String get noEarlierMessages => 'Немає попередніх повідомлень';
725728

729+
@override
730+
String get mutedSender => 'Muted sender';
731+
732+
@override
733+
String get revealButtonLabel => 'Reveal message for muted sender';
734+
726735
@override
727736
String get scrollToBottomTooltip => 'Прокрутити вниз';
728737

lib/widgets/action_sheet.dart

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -568,13 +568,18 @@ void showMessageActionSheet({required BuildContext context, required Message mes
568568
final markAsUnreadSupported = store.zulipFeatureLevel >= 155; // TODO(server-6)
569569
final showMarkAsUnreadButton = markAsUnreadSupported && isMessageRead;
570570

571+
final isSenderMuted = store.isUserMuted(message.senderId);
572+
571573
final optionButtons = [
572574
ReactionButtons(message: message, pageContext: pageContext),
573575
StarButton(message: message, pageContext: pageContext),
574576
if (isComposeBoxOffered)
575577
QuoteAndReplyButton(message: message, pageContext: pageContext),
576578
if (showMarkAsUnreadButton)
577579
MarkAsUnreadButton(message: message, pageContext: pageContext),
580+
if (isSenderMuted)
581+
HideMutedMessageButton(message: message, pageContext: pageContext,
582+
messageContext: context),
578583
CopyMessageTextButton(message: message, pageContext: pageContext),
579584
CopyMessageLinkButton(message: message, pageContext: pageContext),
580585
ShareButton(message: message, pageContext: pageContext),
@@ -841,6 +846,31 @@ class MarkAsUnreadButton extends MessageActionSheetMenuItemButton {
841846
}
842847
}
843848

849+
class HideMutedMessageButton extends MessageActionSheetMenuItemButton {
850+
HideMutedMessageButton({
851+
super.key,
852+
required super.message,
853+
required super.pageContext,
854+
required this.messageContext,
855+
});
856+
857+
final BuildContext messageContext;
858+
859+
@override
860+
IconData get icon => ZulipIcons.eye_off;
861+
862+
@override
863+
String label(ZulipLocalizations zulipLocalizations) {
864+
return zulipLocalizations.actionSheetOptionHideMutedMessage;
865+
}
866+
867+
@override
868+
void onPressed() {
869+
if (!messageContext.mounted) return;
870+
PossibleMutedMessage.of(messageContext).changeMuteStatus(true);
871+
}
872+
}
873+
844874
class CopyMessageTextButton extends MessageActionSheetMenuItemButton {
845875
CopyMessageTextButton({super.key, required super.message, required super.pageContext});
846876

lib/widgets/content.dart

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ import '../model/internal_link.dart';
1717
import '../model/katex.dart';
1818
import 'actions.dart';
1919
import 'code_block.dart';
20+
import 'color.dart';
2021
import 'dialog.dart';
2122
import 'icons.dart';
2223
import 'inset_shadow.dart';
@@ -26,6 +27,7 @@ import 'poll.dart';
2627
import 'scrolling.dart';
2728
import 'store.dart';
2829
import 'text.dart';
30+
import 'theme.dart';
2931

3032
/// A central place for styles for Zulip content (rendered Zulip Markdown).
3133
///
@@ -1658,18 +1660,44 @@ class Avatar extends StatelessWidget {
16581660
required this.userId,
16591661
required this.size,
16601662
required this.borderRadius,
1663+
this.showAsMuted = false,
16611664
});
16621665

16631666
final int userId;
16641667
final double size;
16651668
final double borderRadius;
1669+
final bool showAsMuted;
16661670

16671671
@override
16681672
Widget build(BuildContext context) {
16691673
return AvatarShape(
16701674
size: size,
16711675
borderRadius: borderRadius,
1672-
child: AvatarImage(userId: userId, size: size));
1676+
child: showAsMuted
1677+
? AvatarPlaceholder(
1678+
// Scale the icon proportionally to match the Figma design.
1679+
iconSize: size * 20 / 32
1680+
)
1681+
: AvatarImage(userId: userId, size: size));
1682+
}
1683+
}
1684+
1685+
/// A placeholder avatar for muted users.
1686+
///
1687+
/// Wrap this with [AvatarShape].
1688+
class AvatarPlaceholder extends StatelessWidget {
1689+
const AvatarPlaceholder({super.key, this.iconSize});
1690+
1691+
final double? iconSize;
1692+
1693+
@override
1694+
Widget build(BuildContext context) {
1695+
final designVariables = DesignVariables.of(context);
1696+
return DecoratedBox(
1697+
decoration: BoxDecoration(
1698+
color: designVariables.grey250.withFadedAlpha(0.5)),
1699+
child: Icon(ZulipIcons.person, size: iconSize,
1700+
color: designVariables.grey550.withFadedAlpha(0.5)));
16731701
}
16741702
}
16751703

0 commit comments

Comments
 (0)