Skip to content

Commit c01b196

Browse files
committed
1 parent a2e86f4 commit c01b196

15 files changed

+342
-45
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."
@@ -935,6 +939,14 @@
935939
"@noEarlierMessages": {
936940
"description": "Text to show at the start of a message list if there are no earlier messages."
937941
},
942+
"mutedSender": "Muted sender",
943+
"@mutedSender": {
944+
"description": "Name for a muted user to display in message list."
945+
},
946+
"revealButtonLabel": "Reveal message for muted sender",
947+
"@revealButtonLabel": {
948+
"description": "Label for the button revealing hidden message from a muted sender in message list."
949+
},
938950
"scrollToBottomTooltip": "Scroll to bottom",
939951
"@scrollToBottomTooltip": {
940952
"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
@@ -305,6 +305,12 @@ abstract class ZulipLocalizations {
305305
/// **'Mark as unread from here'**
306306
String get actionSheetOptionMarkAsUnread;
307307

308+
/// Label for hide muted message again button on action sheet.
309+
///
310+
/// In en, this message translates to:
311+
/// **'Hide muted message again'**
312+
String get actionSheetOptionHideMutedMessage;
313+
308314
/// Label for share button on action sheet.
309315
///
310316
/// In en, this message translates to:
@@ -1379,6 +1385,18 @@ abstract class ZulipLocalizations {
13791385
/// **'No earlier messages'**
13801386
String get noEarlierMessages;
13811387

1388+
/// Name for a muted user to display in message list.
1389+
///
1390+
/// In en, this message translates to:
1391+
/// **'Muted sender'**
1392+
String get mutedSender;
1393+
1394+
/// Label for the button revealing hidden message from a muted sender in message list.
1395+
///
1396+
/// In en, this message translates to:
1397+
/// **'Reveal message for muted sender'**
1398+
String get revealButtonLabel;
1399+
13821400
/// Tooltip for button to scroll to bottom.
13831401
///
13841402
/// 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

@@ -759,6 +762,12 @@ class ZulipLocalizationsAr extends ZulipLocalizations {
759762
@override
760763
String get noEarlierMessages => 'No earlier messages';
761764

765+
@override
766+
String get mutedSender => 'Muted sender';
767+
768+
@override
769+
String get revealButtonLabel => 'Reveal message for muted sender';
770+
762771
@override
763772
String get scrollToBottomTooltip => 'Scroll to bottom';
764773

lib/generated/l10n/zulip_localizations_de.dart

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,9 @@ class ZulipLocalizationsDe 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

@@ -759,6 +762,12 @@ class ZulipLocalizationsDe extends ZulipLocalizations {
759762
@override
760763
String get noEarlierMessages => 'No earlier messages';
761764

765+
@override
766+
String get mutedSender => 'Muted sender';
767+
768+
@override
769+
String get revealButtonLabel => 'Reveal message for muted sender';
770+
762771
@override
763772
String get scrollToBottomTooltip => 'Scroll to bottom';
764773

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

@@ -759,6 +762,12 @@ class ZulipLocalizationsEn extends ZulipLocalizations {
759762
@override
760763
String get noEarlierMessages => 'No earlier messages';
761764

765+
@override
766+
String get mutedSender => 'Muted sender';
767+
768+
@override
769+
String get revealButtonLabel => 'Reveal message for muted sender';
770+
762771
@override
763772
String get scrollToBottomTooltip => 'Scroll to bottom';
764773

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

@@ -759,6 +762,12 @@ class ZulipLocalizationsJa extends ZulipLocalizations {
759762
@override
760763
String get noEarlierMessages => 'No earlier messages';
761764

765+
@override
766+
String get mutedSender => 'Muted sender';
767+
768+
@override
769+
String get revealButtonLabel => 'Reveal message for muted sender';
770+
762771
@override
763772
String get scrollToBottomTooltip => 'Scroll to bottom';
764773

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

@@ -759,6 +762,12 @@ class ZulipLocalizationsNb extends ZulipLocalizations {
759762
@override
760763
String get noEarlierMessages => 'No earlier messages';
761764

765+
@override
766+
String get mutedSender => 'Muted sender';
767+
768+
@override
769+
String get revealButtonLabel => 'Reveal message for muted sender';
770+
762771
@override
763772
String get scrollToBottomTooltip => 'Scroll to bottom';
764773

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

@@ -770,6 +773,12 @@ class ZulipLocalizationsPl extends ZulipLocalizations {
770773
@override
771774
String get noEarlierMessages => 'Brak historii';
772775

776+
@override
777+
String get mutedSender => 'Muted sender';
778+
779+
@override
780+
String get revealButtonLabel => 'Reveal message for muted sender';
781+
773782
@override
774783
String get scrollToBottomTooltip => 'Przewiń do dołu';
775784

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

@@ -773,6 +776,12 @@ class ZulipLocalizationsRu extends ZulipLocalizations {
773776
@override
774777
String get noEarlierMessages => 'Предшествующих сообщений нет';
775778

779+
@override
780+
String get mutedSender => 'Muted sender';
781+
782+
@override
783+
String get revealButtonLabel => 'Reveal message for muted sender';
784+
776785
@override
777786
String get scrollToBottomTooltip => 'Пролистать вниз';
778787

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

@@ -761,6 +764,12 @@ class ZulipLocalizationsSk extends ZulipLocalizations {
761764
@override
762765
String get noEarlierMessages => 'No earlier messages';
763766

767+
@override
768+
String get mutedSender => 'Muted sender';
769+
770+
@override
771+
String get revealButtonLabel => 'Reveal message for muted sender';
772+
764773
@override
765774
String get scrollToBottomTooltip => 'Scroll to bottom';
766775

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

@@ -773,6 +776,12 @@ class ZulipLocalizationsUk extends ZulipLocalizations {
773776
@override
774777
String get noEarlierMessages => 'Немає попередніх повідомлень';
775778

779+
@override
780+
String get mutedSender => 'Muted sender';
781+
782+
@override
783+
String get revealButtonLabel => 'Reveal message for muted sender';
784+
776785
@override
777786
String get scrollToBottomTooltip => 'Прокрутити вниз';
778787

lib/widgets/action_sheet.dart

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

572+
final isSenderMuted = store.isUserMuted(message.senderId);
573+
572574
final optionButtons = [
573575
if (popularEmojiLoaded)
574576
ReactionButtons(message: message, pageContext: pageContext),
@@ -577,6 +579,9 @@ void showMessageActionSheet({required BuildContext context, required Message mes
577579
QuoteAndReplyButton(message: message, pageContext: pageContext),
578580
if (showMarkAsUnreadButton)
579581
MarkAsUnreadButton(message: message, pageContext: pageContext),
582+
if (isSenderMuted)
583+
HideMutedMessageButton(message: message, pageContext: pageContext,
584+
messageContext: context),
580585
CopyMessageTextButton(message: message, pageContext: pageContext),
581586
CopyMessageLinkButton(message: message, pageContext: pageContext),
582587
ShareButton(message: message, pageContext: pageContext),
@@ -882,6 +887,31 @@ class MarkAsUnreadButton extends MessageActionSheetMenuItemButton {
882887
}
883888
}
884889

890+
class HideMutedMessageButton extends MessageActionSheetMenuItemButton {
891+
HideMutedMessageButton({
892+
super.key,
893+
required super.message,
894+
required super.pageContext,
895+
required this.messageContext,
896+
});
897+
898+
final BuildContext messageContext;
899+
900+
@override
901+
IconData get icon => ZulipIcons.eye_off;
902+
903+
@override
904+
String label(ZulipLocalizations zulipLocalizations) {
905+
return zulipLocalizations.actionSheetOptionHideMutedMessage;
906+
}
907+
908+
@override
909+
void onPressed() {
910+
if (!messageContext.mounted) return;
911+
PossibleMutedMessage.of(messageContext).changeMuteStatus(true);
912+
}
913+
}
914+
885915
class CopyMessageTextButton extends MessageActionSheetMenuItemButton {
886916
CopyMessageTextButton({super.key, required super.message, required super.pageContext});
887917

lib/widgets/content.dart

Lines changed: 28 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,43 @@ 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(size: size)
1678+
: AvatarImage(userId: userId, size: size));
1679+
}
1680+
}
1681+
1682+
/// A placeholder avatar for muted users.
1683+
///
1684+
/// Wrap this with [AvatarShape].
1685+
class AvatarPlaceholder extends StatelessWidget {
1686+
const AvatarPlaceholder({super.key, this.size});
1687+
1688+
final double? size;
1689+
1690+
@override
1691+
Widget build(BuildContext context) {
1692+
final designVariables = DesignVariables.of(context);
1693+
return DecoratedBox(
1694+
decoration: BoxDecoration(
1695+
color: designVariables.grey250.withFadedAlpha(0.5)),
1696+
child: Icon(ZulipIcons.person,
1697+
// Scale the icon proportionally to match the Figma design.
1698+
size: size != null ? size! * 20 / 32 : null,
1699+
color: designVariables.grey550.withFadedAlpha(0.5)));
16731700
}
16741701
}
16751702

0 commit comments

Comments
 (0)