Skip to content

Commit

Permalink
keys/views: Add = key to toggle agreement with first message reaction.
Browse files Browse the repository at this point in the history
Hotkeys document updated.
  • Loading branch information
jagadeesh-akshaya authored and rsashank committed Sep 16, 2023
1 parent 59bb891 commit 68430d8
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 0 deletions.
1 change: 1 addition & 0 deletions docs/hotkeys.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@
|Narrow to the stream of the current message|<kbd>s</kbd>|
|Narrow to the topic of the current message|<kbd>S</kbd>|
|Narrow to a topic/direct-chat, or stream/all-direct-messages|<kbd>z</kbd>|
|Toggle first emoji reaction on selected message|<kbd>=</kbd>|
|Add/remove thumbs-up reaction to the current message|<kbd>+</kbd>|
|Add/remove star status of the current message|<kbd>ctrl</kbd> + <kbd>s</kbd> / <kbd>*</kbd>|
|Show/hide message information|<kbd>i</kbd>|
Expand Down
5 changes: 5 additions & 0 deletions zulipterminal/config/keys.py
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,11 @@ class KeyBinding(TypedDict):
'Narrow to a topic/direct-chat, or stream/all-direct-messages',
'key_category': 'msg_actions',
},
'REACTION_AGREEMENT': {
'keys': ['='],
'help_text': 'Toggle first emoji reaction on selected message',
'key_category': 'msg_actions',
},
'TOGGLE_TOPIC': {
'keys': ['t'],
'help_text': 'Toggle topics in a stream',
Expand Down
9 changes: 9 additions & 0 deletions zulipterminal/ui_tools/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,15 @@ def keypress(self, size: urwid_Size, key: str) -> Optional[str]:
message = self.focus.original_widget.message
self.model.toggle_message_star_status(message)

elif is_command_key("REACTION_AGREEMENT", key) and self.focus is not None:
message = self.focus.original_widget.message
message_reactions = message["reactions"]
if len(message_reactions) > 0:
for reaction in message_reactions:
emoji = reaction["emoji_name"]
self.model.toggle_message_reaction(message, emoji)
break

key = super().keypress(size, key)
return key

Expand Down

0 comments on commit 68430d8

Please sign in to comment.