Skip to content

Commit 854081e

Browse files
committed
1 parent ed38fca commit 854081e

14 files changed

+333
-41
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."
@@ -879,6 +883,14 @@
879883
"@noEarlierMessages": {
880884
"description": "Text to show at the start of a message list if there are no earlier messages."
881885
},
886+
"mutedSender": "Muted sender",
887+
"@mutedSender": {
888+
"description": "Name for a muted user to display in message list."
889+
},
890+
"revealButtonLabel": "Reveal message for muted sender",
891+
"@revealButtonLabel": {
892+
"description": "Label for the button revealing hidden message from a muted sender in message list."
893+
},
882894
"scrollToBottomTooltip": "Scroll to bottom",
883895
"@scrollToBottomTooltip": {
884896
"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:
@@ -1292,6 +1298,18 @@ abstract class ZulipLocalizations {
12921298
/// **'No earlier messages'**
12931299
String get noEarlierMessages;
12941300

1301+
/// Name for a muted user to display in message list.
1302+
///
1303+
/// In en, this message translates to:
1304+
/// **'Muted sender'**
1305+
String get mutedSender;
1306+
1307+
/// Label for the button revealing hidden message from a muted sender in message list.
1308+
///
1309+
/// In en, this message translates to:
1310+
/// **'Reveal message for muted sender'**
1311+
String get revealButtonLabel;
1312+
12951313
/// Tooltip for button to scroll to bottom.
12961314
///
12971315
/// 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

@@ -714,6 +717,12 @@ class ZulipLocalizationsAr extends ZulipLocalizations {
714717
@override
715718
String get noEarlierMessages => 'No earlier messages';
716719

720+
@override
721+
String get mutedSender => 'Muted sender';
722+
723+
@override
724+
String get revealButtonLabel => 'Reveal message for muted sender';
725+
717726
@override
718727
String get scrollToBottomTooltip => 'Scroll to bottom';
719728

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

@@ -714,6 +717,12 @@ class ZulipLocalizationsEn extends ZulipLocalizations {
714717
@override
715718
String get noEarlierMessages => 'No earlier messages';
716719

720+
@override
721+
String get mutedSender => 'Muted sender';
722+
723+
@override
724+
String get revealButtonLabel => 'Reveal message for muted sender';
725+
717726
@override
718727
String get scrollToBottomTooltip => 'Scroll to bottom';
719728

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

@@ -714,6 +717,12 @@ class ZulipLocalizationsJa extends ZulipLocalizations {
714717
@override
715718
String get noEarlierMessages => 'No earlier messages';
716719

720+
@override
721+
String get mutedSender => 'Muted sender';
722+
723+
@override
724+
String get revealButtonLabel => 'Reveal message for muted sender';
725+
717726
@override
718727
String get scrollToBottomTooltip => 'Scroll to bottom';
719728

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

@@ -714,6 +717,12 @@ class ZulipLocalizationsNb extends ZulipLocalizations {
714717
@override
715718
String get noEarlierMessages => 'No earlier messages';
716719

720+
@override
721+
String get mutedSender => 'Muted sender';
722+
723+
@override
724+
String get revealButtonLabel => 'Reveal message for muted sender';
725+
717726
@override
718727
String get scrollToBottomTooltip => 'Scroll to bottom';
719728

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

@@ -725,6 +728,12 @@ class ZulipLocalizationsPl extends ZulipLocalizations {
725728
@override
726729
String get noEarlierMessages => 'Brak historii';
727730

731+
@override
732+
String get mutedSender => 'Muted sender';
733+
734+
@override
735+
String get revealButtonLabel => 'Reveal message for muted sender';
736+
728737
@override
729738
String get scrollToBottomTooltip => 'Przewiń do dołu';
730739

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

@@ -728,6 +731,12 @@ class ZulipLocalizationsRu extends ZulipLocalizations {
728731
@override
729732
String get noEarlierMessages => 'Предшествующих сообщений нет';
730733

734+
@override
735+
String get mutedSender => 'Muted sender';
736+
737+
@override
738+
String get revealButtonLabel => 'Reveal message for muted sender';
739+
731740
@override
732741
String get scrollToBottomTooltip => 'Пролистать вниз';
733742

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

@@ -716,6 +719,12 @@ class ZulipLocalizationsSk extends ZulipLocalizations {
716719
@override
717720
String get noEarlierMessages => 'No earlier messages';
718721

722+
@override
723+
String get mutedSender => 'Muted sender';
724+
725+
@override
726+
String get revealButtonLabel => 'Reveal message for muted sender';
727+
719728
@override
720729
String get scrollToBottomTooltip => 'Scroll to bottom';
721730

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

@@ -728,6 +731,12 @@ class ZulipLocalizationsUk extends ZulipLocalizations {
728731
@override
729732
String get noEarlierMessages => 'Немає попередніх повідомлень';
730733

734+
@override
735+
String get mutedSender => 'Muted sender';
736+
737+
@override
738+
String get revealButtonLabel => 'Reveal message for muted sender';
739+
731740
@override
732741
String get scrollToBottomTooltip => 'Прокрутити вниз';
733742

lib/widgets/action_sheet.dart

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

569+
final isSenderMuted = store.isUserMuted(message.senderId);
570+
569571
final optionButtons = [
570572
ReactionButtons(message: message, pageContext: pageContext),
571573
StarButton(message: message, pageContext: pageContext),
572574
if (isComposeBoxOffered)
573575
QuoteAndReplyButton(message: message, pageContext: pageContext),
574576
if (showMarkAsUnreadButton)
575577
MarkAsUnreadButton(message: message, pageContext: pageContext),
578+
if (isSenderMuted)
579+
HideMutedMessageButton(message: message, pageContext: pageContext,
580+
messageContext: context),
576581
CopyMessageTextButton(message: message, pageContext: pageContext),
577582
CopyMessageLinkButton(message: message, pageContext: pageContext),
578583
ShareButton(message: message, pageContext: pageContext),
@@ -839,6 +844,31 @@ class MarkAsUnreadButton extends MessageActionSheetMenuItemButton {
839844
}
840845
}
841846

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

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)