Skip to content

Commit

Permalink
reactions: Add sheet to view who reacted to a message
Browse files Browse the repository at this point in the history
Fixes zulip#740
  • Loading branch information
chimnayajith committed Jan 24, 2025
1 parent 05d33e1 commit dde36b5
Show file tree
Hide file tree
Showing 13 changed files with 457 additions and 4 deletions.
8 changes: 8 additions & 0 deletions assets/l10n/app_en.arb
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,10 @@
"@actionSheetOptionShare": {
"description": "Label for share button on action sheet."
},
"actionSheetOptionViewReactions": "See who reacted",
"@actionSheetOptionViewReactions": {
"description": "Label for View Reactions button on action sheet."
},
"actionSheetOptionQuoteAndReply": "Quote and reply",
"@actionSheetOptionQuoteAndReply": {
"description": "Label for Quote and reply button on action sheet."
Expand All @@ -116,6 +120,10 @@
"@actionSheetOptionUnstarMessage": {
"description": "Label for unstar button on action sheet."
},
"reactionSheetEmptyReactions": "No reactions yet",
"@reactionSheetEmptyReactions": {
"description": "Text to display when the reactions sheet is open, but there are no reactions to show."
},
"errorWebAuthOperationalErrorTitle": "Something went wrong",
"@errorWebAuthOperationalErrorTitle": {
"description": "Error title when third-party authentication has an operational error (not necessarily caused by invalid credentials)."
Expand Down
12 changes: 12 additions & 0 deletions lib/generated/l10n/zulip_localizations.dart
Original file line number Diff line number Diff line change
Expand Up @@ -261,6 +261,12 @@ abstract class ZulipLocalizations {
/// **'Share'**
String get actionSheetOptionShare;

/// Label for View Reactions button on action sheet.
///
/// In en, this message translates to:
/// **'See who reacted'**
String get actionSheetOptionViewReactions;

/// Label for Quote and reply button on action sheet.
///
/// In en, this message translates to:
Expand All @@ -279,6 +285,12 @@ abstract class ZulipLocalizations {
/// **'Unstar message'**
String get actionSheetOptionUnstarMessage;

/// Text to display when the reactions sheet is open, but there are no reactions to show.
///
/// In en, this message translates to:
/// **'No reactions yet'**
String get reactionSheetEmptyReactions;

/// Error title when third-party authentication has an operational error (not necessarily caused by invalid credentials).
///
/// In en, this message translates to:
Expand Down
6 changes: 6 additions & 0 deletions lib/generated/l10n/zulip_localizations_ar.dart
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,9 @@ class ZulipLocalizationsAr extends ZulipLocalizations {
@override
String get actionSheetOptionShare => 'Share';

@override
String get actionSheetOptionViewReactions => 'See who reacted';

@override
String get actionSheetOptionQuoteAndReply => 'Quote and reply';

Expand All @@ -97,6 +100,9 @@ class ZulipLocalizationsAr extends ZulipLocalizations {
@override
String get actionSheetOptionUnstarMessage => 'Unstar message';

@override
String get reactionSheetEmptyReactions => 'No reactions yet';

@override
String get errorWebAuthOperationalErrorTitle => 'Something went wrong';

Expand Down
6 changes: 6 additions & 0 deletions lib/generated/l10n/zulip_localizations_en.dart
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,9 @@ class ZulipLocalizationsEn extends ZulipLocalizations {
@override
String get actionSheetOptionShare => 'Share';

@override
String get actionSheetOptionViewReactions => 'See who reacted';

@override
String get actionSheetOptionQuoteAndReply => 'Quote and reply';

Expand All @@ -97,6 +100,9 @@ class ZulipLocalizationsEn extends ZulipLocalizations {
@override
String get actionSheetOptionUnstarMessage => 'Unstar message';

@override
String get reactionSheetEmptyReactions => 'No reactions yet';

@override
String get errorWebAuthOperationalErrorTitle => 'Something went wrong';

Expand Down
6 changes: 6 additions & 0 deletions lib/generated/l10n/zulip_localizations_ja.dart
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,9 @@ class ZulipLocalizationsJa extends ZulipLocalizations {
@override
String get actionSheetOptionShare => 'Share';

@override
String get actionSheetOptionViewReactions => 'See who reacted';

@override
String get actionSheetOptionQuoteAndReply => 'Quote and reply';

Expand All @@ -97,6 +100,9 @@ class ZulipLocalizationsJa extends ZulipLocalizations {
@override
String get actionSheetOptionUnstarMessage => 'Unstar message';

@override
String get reactionSheetEmptyReactions => 'No reactions yet';

@override
String get errorWebAuthOperationalErrorTitle => 'Something went wrong';

Expand Down
6 changes: 6 additions & 0 deletions lib/generated/l10n/zulip_localizations_nb.dart
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,9 @@ class ZulipLocalizationsNb extends ZulipLocalizations {
@override
String get actionSheetOptionShare => 'Share';

@override
String get actionSheetOptionViewReactions => 'See who reacted';

@override
String get actionSheetOptionQuoteAndReply => 'Quote and reply';

Expand All @@ -97,6 +100,9 @@ class ZulipLocalizationsNb extends ZulipLocalizations {
@override
String get actionSheetOptionUnstarMessage => 'Unstar message';

@override
String get reactionSheetEmptyReactions => 'No reactions yet';

@override
String get errorWebAuthOperationalErrorTitle => 'Something went wrong';

Expand Down
6 changes: 6 additions & 0 deletions lib/generated/l10n/zulip_localizations_pl.dart
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,9 @@ class ZulipLocalizationsPl extends ZulipLocalizations {
@override
String get actionSheetOptionShare => 'Udostępnij';

@override
String get actionSheetOptionViewReactions => 'See who reacted';

@override
String get actionSheetOptionQuoteAndReply => 'Odpowiedz cytując';

Expand All @@ -97,6 +100,9 @@ class ZulipLocalizationsPl extends ZulipLocalizations {
@override
String get actionSheetOptionUnstarMessage => 'Odbierz gwiazdkę';

@override
String get reactionSheetEmptyReactions => 'No reactions yet';

@override
String get errorWebAuthOperationalErrorTitle => 'Coś poszło nie tak';

Expand Down
6 changes: 6 additions & 0 deletions lib/generated/l10n/zulip_localizations_ru.dart
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,9 @@ class ZulipLocalizationsRu extends ZulipLocalizations {
@override
String get actionSheetOptionShare => 'Поделиться';

@override
String get actionSheetOptionViewReactions => 'See who reacted';

@override
String get actionSheetOptionQuoteAndReply => 'Ответить с цитированием';

Expand All @@ -97,6 +100,9 @@ class ZulipLocalizationsRu extends ZulipLocalizations {
@override
String get actionSheetOptionUnstarMessage => 'Снять отметку с сообщения';

@override
String get reactionSheetEmptyReactions => 'No reactions yet';

@override
String get errorWebAuthOperationalErrorTitle => 'Что-то пошло не так';

Expand Down
6 changes: 6 additions & 0 deletions lib/generated/l10n/zulip_localizations_sk.dart
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,9 @@ class ZulipLocalizationsSk extends ZulipLocalizations {
@override
String get actionSheetOptionShare => 'Zdielať';

@override
String get actionSheetOptionViewReactions => 'See who reacted';

@override
String get actionSheetOptionQuoteAndReply => 'Citovať a odpovedať';

Expand All @@ -97,6 +100,9 @@ class ZulipLocalizationsSk extends ZulipLocalizations {
@override
String get actionSheetOptionUnstarMessage => 'Odhviezdičkovať správu';

@override
String get reactionSheetEmptyReactions => 'No reactions yet';

@override
String get errorWebAuthOperationalErrorTitle => 'Niečo sa pokazilo';

Expand Down
21 changes: 21 additions & 0 deletions lib/widgets/action_sheet.dart
Original file line number Diff line number Diff line change
Expand Up @@ -392,6 +392,8 @@ void showMessageActionSheet({required BuildContext context, required Message mes

final optionButtons = [
ReactionButtons(message: message, pageContext: context),
if((message.reactions?.total ?? 0) > 0)
ViewReactionsButton(message: message, pageContext: context),
StarButton(message: message, pageContext: context),
if (isComposeBoxOffered)
QuoteAndReplyButton(message: message, pageContext: context),
Expand Down Expand Up @@ -692,6 +694,25 @@ class QuoteAndReplyButton extends MessageActionSheetMenuItemButton {
}
}

class ViewReactionsButton extends MessageActionSheetMenuItemButton {
ViewReactionsButton({super.key, required super.message, required super.pageContext});

@override IconData get icon => ZulipIcons.reactions;

@override
String label(ZulipLocalizations zulipLocalizations) {
return zulipLocalizations.actionSheetOptionViewReactions;
}

@override void onPressed() async {
showReactionListSheet(
pageContext,
messageId: message.id,
messageListView: MessageListPage.ancestorOf(pageContext).model,
);
}
}

class MarkAsUnreadButton extends MessageActionSheetMenuItemButton {
MarkAsUnreadButton({super.key, required super.message, required super.pageContext});

Expand Down
Loading

0 comments on commit dde36b5

Please sign in to comment.