Skip to content

Distinguish muted users in UI #1429

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

Draft
wants to merge 11 commits into
base: main
Choose a base branch
from
Binary file modified assets/icons/ZulipIcons.ttf
Binary file not shown.
3 changes: 3 additions & 0 deletions assets/icons/eye.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions assets/icons/eye_off.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions assets/icons/person.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
File renamed without changes
16 changes: 16 additions & 0 deletions assets/l10n/app_en.arb
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,10 @@
"@actionSheetOptionMarkAsUnread": {
"description": "Label for mark as unread button on action sheet."
},
"actionSheetOptionHideMutedMessage": "Hide muted message again",
"@actionSheetOptionHideMutedMessage": {
"description": "Label for hide muted message again button on action sheet."
},
"actionSheetOptionShare": "Share",
"@actionSheetOptionShare": {
"description": "Label for share button on action sheet."
Expand Down Expand Up @@ -872,6 +876,18 @@
"@noEarlierMessages": {
"description": "Text to show at the start of a message list if there are no earlier messages."
},
"mutedSender": "Muted sender",
"@mutedSender": {
"description": "Name for a muted user to display in message list."
},
"revealButtonLabel": "Reveal message for muted sender",
"@revealButtonLabel": {
"description": "Label for the button revealing hidden message from a muted sender in message list."
},
"mutedUser": "Muted user",
"@mutedUser": {
"description": "Name for a muted user to display all over the app."
},
"scrollToBottomTooltip": "Scroll to bottom",
"@scrollToBottomTooltip": {
"description": "Tooltip for button to scroll to bottom."
Expand Down
19 changes: 19 additions & 0 deletions lib/api/model/events.dart
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ sealed class Event {
}
// case 'muted_topics': … // TODO(#422) we ignore this feature on older servers
case 'user_topic': return UserTopicEvent.fromJson(json);
case 'muted_users': return MutedUsersEvent.fromJson(json);
case 'message': return MessageEvent.fromJson(json);
case 'update_message': return UpdateMessageEvent.fromJson(json);
case 'delete_message': return DeleteMessageEvent.fromJson(json);
Expand Down Expand Up @@ -664,6 +665,24 @@ class UserTopicEvent extends Event {
Map<String, dynamic> toJson() => _$UserTopicEventToJson(this);
}

/// A Zulip event of type `muted_users`: https://zulip.com/api/get-events#muted_users
@JsonSerializable(fieldRename: FieldRename.snake)
class MutedUsersEvent extends Event {
@override
@JsonKey(includeToJson: true)
String get type => 'muted_users';

final List<MutedUserItem> mutedUsers;

MutedUsersEvent({required super.id, required this.mutedUsers});

factory MutedUsersEvent.fromJson(Map<String, dynamic> json) =>
_$MutedUsersEventFromJson(json);

@override
Map<String, dynamic> toJson() => _$MutedUsersEventToJson(this);
}

/// A Zulip event of type `message`: https://zulip.com/api/get-events#message
@JsonSerializable(fieldRename: FieldRename.snake)
class MessageEvent extends Event {
Expand Down
16 changes: 16 additions & 0 deletions lib/api/model/events.g.dart

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions lib/api/model/initial_snapshot.dart
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ class InitialSnapshot {

// final List<…> mutedTopics; // TODO(#422) we ignore this feature on older servers

final List<MutedUserItem> mutedUsers;

final Map<String, RealmEmojiItem> realmEmoji;

final List<RecentDmConversation> recentPrivateConversations;
Expand Down Expand Up @@ -130,6 +132,7 @@ class InitialSnapshot {
required this.serverTypingStartedExpiryPeriodMilliseconds,
required this.serverTypingStoppedWaitPeriodMilliseconds,
required this.serverTypingStartedWaitPeriodMilliseconds,
required this.mutedUsers,
required this.realmEmoji,
required this.recentPrivateConversations,
required this.subscriptions,
Expand Down
5 changes: 5 additions & 0 deletions lib/api/model/initial_snapshot.g.dart

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

18 changes: 18 additions & 0 deletions lib/api/model/model.dart
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,24 @@ class CustomProfileFieldExternalAccountData {
Map<String, dynamic> toJson() => _$CustomProfileFieldExternalAccountDataToJson(this);
}


/// An item in the [InitialSnapshot.mutedUsers].
///
/// For docs, search for "muted_users:"
/// in <https://zulip.com/api/register-queue>.
@JsonSerializable(fieldRename: FieldRename.snake)
class MutedUserItem {
final int id;
final int timestamp;

const MutedUserItem({required this.id, required this.timestamp});

factory MutedUserItem.fromJson(Map<String, dynamic> json) =>
_$MutedUserItemFromJson(json);

Map<String, dynamic> toJson() => _$MutedUserItemToJson(this);
}

/// An item in [InitialSnapshot.realmEmoji] or [RealmEmojiUpdateEvent].
///
/// For docs, search for "realm_emoji:"
Expand Down
9 changes: 9 additions & 0 deletions lib/api/model/model.g.dart

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

24 changes: 24 additions & 0 deletions lib/generated/l10n/zulip_localizations.dart
Original file line number Diff line number Diff line change
Expand Up @@ -302,6 +302,12 @@ abstract class ZulipLocalizations {
/// **'Mark as unread from here'**
String get actionSheetOptionMarkAsUnread;

/// Label for hide muted message again button on action sheet.
///
/// In en, this message translates to:
/// **'Hide muted message again'**
String get actionSheetOptionHideMutedMessage;

/// Label for share button on action sheet.
///
/// In en, this message translates to:
Expand Down Expand Up @@ -1286,6 +1292,24 @@ abstract class ZulipLocalizations {
/// **'No earlier messages'**
String get noEarlierMessages;

/// Name for a muted user to display in message list.
///
/// In en, this message translates to:
/// **'Muted sender'**
String get mutedSender;

/// Label for the button revealing hidden message from a muted sender in message list.
///
/// In en, this message translates to:
/// **'Reveal message for muted sender'**
String get revealButtonLabel;

/// Name for a muted user to display all over the app.
///
/// In en, this message translates to:
/// **'Muted user'**
String get mutedUser;

/// Tooltip for button to scroll to bottom.
///
/// In en, this message translates to:
Expand Down
12 changes: 12 additions & 0 deletions lib/generated/l10n/zulip_localizations_ar.dart
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,9 @@ class ZulipLocalizationsAr extends ZulipLocalizations {
@override
String get actionSheetOptionMarkAsUnread => 'Mark as unread from here';

@override
String get actionSheetOptionHideMutedMessage => 'Hide muted message again';

@override
String get actionSheetOptionShare => 'Share';

Expand Down Expand Up @@ -709,6 +712,15 @@ class ZulipLocalizationsAr extends ZulipLocalizations {
@override
String get noEarlierMessages => 'No earlier messages';

@override
String get mutedSender => 'Muted sender';

@override
String get revealButtonLabel => 'Reveal message for muted sender';

@override
String get mutedUser => 'Muted user';

@override
String get scrollToBottomTooltip => 'Scroll to bottom';

Expand Down
12 changes: 12 additions & 0 deletions lib/generated/l10n/zulip_localizations_en.dart
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,9 @@ class ZulipLocalizationsEn extends ZulipLocalizations {
@override
String get actionSheetOptionMarkAsUnread => 'Mark as unread from here';

@override
String get actionSheetOptionHideMutedMessage => 'Hide muted message again';

@override
String get actionSheetOptionShare => 'Share';

Expand Down Expand Up @@ -709,6 +712,15 @@ class ZulipLocalizationsEn extends ZulipLocalizations {
@override
String get noEarlierMessages => 'No earlier messages';

@override
String get mutedSender => 'Muted sender';

@override
String get revealButtonLabel => 'Reveal message for muted sender';

@override
String get mutedUser => 'Muted user';

@override
String get scrollToBottomTooltip => 'Scroll to bottom';

Expand Down
12 changes: 12 additions & 0 deletions lib/generated/l10n/zulip_localizations_ja.dart
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,9 @@ class ZulipLocalizationsJa extends ZulipLocalizations {
@override
String get actionSheetOptionMarkAsUnread => 'Mark as unread from here';

@override
String get actionSheetOptionHideMutedMessage => 'Hide muted message again';

@override
String get actionSheetOptionShare => 'Share';

Expand Down Expand Up @@ -709,6 +712,15 @@ class ZulipLocalizationsJa extends ZulipLocalizations {
@override
String get noEarlierMessages => 'No earlier messages';

@override
String get mutedSender => 'Muted sender';

@override
String get revealButtonLabel => 'Reveal message for muted sender';

@override
String get mutedUser => 'Muted user';

@override
String get scrollToBottomTooltip => 'Scroll to bottom';

Expand Down
12 changes: 12 additions & 0 deletions lib/generated/l10n/zulip_localizations_nb.dart
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,9 @@ class ZulipLocalizationsNb extends ZulipLocalizations {
@override
String get actionSheetOptionMarkAsUnread => 'Mark as unread from here';

@override
String get actionSheetOptionHideMutedMessage => 'Hide muted message again';

@override
String get actionSheetOptionShare => 'Share';

Expand Down Expand Up @@ -709,6 +712,15 @@ class ZulipLocalizationsNb extends ZulipLocalizations {
@override
String get noEarlierMessages => 'No earlier messages';

@override
String get mutedSender => 'Muted sender';

@override
String get revealButtonLabel => 'Reveal message for muted sender';

@override
String get mutedUser => 'Muted user';

@override
String get scrollToBottomTooltip => 'Scroll to bottom';

Expand Down
12 changes: 12 additions & 0 deletions lib/generated/l10n/zulip_localizations_pl.dart
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,9 @@ class ZulipLocalizationsPl extends ZulipLocalizations {
String get actionSheetOptionMarkAsUnread =>
'Odtąd oznacz jako nieprzeczytane';

@override
String get actionSheetOptionHideMutedMessage => 'Hide muted message again';

@override
String get actionSheetOptionShare => 'Udostępnij';

Expand Down Expand Up @@ -720,6 +723,15 @@ class ZulipLocalizationsPl extends ZulipLocalizations {
@override
String get noEarlierMessages => 'Brak historii';

@override
String get mutedSender => 'Muted sender';

@override
String get revealButtonLabel => 'Reveal message for muted sender';

@override
String get mutedUser => 'Muted user';

@override
String get scrollToBottomTooltip => 'Przewiń do dołu';

Expand Down
12 changes: 12 additions & 0 deletions lib/generated/l10n/zulip_localizations_ru.dart
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,9 @@ class ZulipLocalizationsRu extends ZulipLocalizations {
String get actionSheetOptionMarkAsUnread =>
'Отметить как непрочитанные начиная отсюда';

@override
String get actionSheetOptionHideMutedMessage => 'Hide muted message again';

@override
String get actionSheetOptionShare => 'Поделиться';

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

@override
String get mutedSender => 'Muted sender';

@override
String get revealButtonLabel => 'Reveal message for muted sender';

@override
String get mutedUser => 'Muted user';

@override
String get scrollToBottomTooltip => 'Пролистать вниз';

Expand Down
12 changes: 12 additions & 0 deletions lib/generated/l10n/zulip_localizations_sk.dart
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,9 @@ class ZulipLocalizationsSk extends ZulipLocalizations {
String get actionSheetOptionMarkAsUnread =>
'Označiť ako neprečítané od tejto správy';

@override
String get actionSheetOptionHideMutedMessage => 'Hide muted message again';

@override
String get actionSheetOptionShare => 'Zdielať';

Expand Down Expand Up @@ -711,6 +714,15 @@ class ZulipLocalizationsSk extends ZulipLocalizations {
@override
String get noEarlierMessages => 'No earlier messages';

@override
String get mutedSender => 'Muted sender';

@override
String get revealButtonLabel => 'Reveal message for muted sender';

@override
String get mutedUser => 'Muted user';

@override
String get scrollToBottomTooltip => 'Scroll to bottom';

Expand Down
Loading
Loading