Skip to content

Commit badf47a

Browse files
sumanthvraoneiljp
authored andcommitted
README/keys/ui: Add 'ALL_MENTIONS' hotkey to display @ mentions.
* ALL_MENTIONS key added to the key_category 'navigation'. * README updated. * Connect ALL_MENTIONS view via keypress. * Tests added for the keypress ALL_MENTIONS.
1 parent 20d8c79 commit badf47a

File tree

4 files changed

+20
-0
lines changed

4 files changed

+20
-0
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,7 @@ Install-Module -Name BurntToast
116116
| Go to the last message | <kbd>G</kbd> / <kbd>end</kbd> |
117117
| Narrow to all private messages | <kbd>P</kbd> |
118118
| Narrow to all starred messages | <kbd>f</kbd> |
119+
| Narrow to messages in which you're mentioned | <kbd>#</kbd> |
119120
| Next unread topic | <kbd>n</kbd> |
120121
| Next unread private message | <kbd>p</kbd> |
121122

tests/ui/test_ui.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -205,6 +205,17 @@ def test_keypress_normal_mode_navigation(self, view, mocker,
205205
view.keypress(size, key)
206206
super_view.assert_called_once_with(size, expected_key)
207207

208+
def test_keypress_ALL_MENTIONS(self, view, mocker):
209+
view.body = mocker.Mock()
210+
view.body.focus_col = None
211+
view.controller.editor_mode = False
212+
size = (20,)
213+
view.model.controller.show_all_mentions = mocker.Mock()
214+
215+
view.keypress(size, "#")
216+
view.model.controller.show_all_mentions.assert_called_once_with(view)
217+
assert view.body.focus_col == 1
218+
208219
@pytest.mark.parametrize('autohide', [True, False], ids=[
209220
'autohide', 'no_autohide'])
210221
def test_keypress_w(self, view, mocker, autohide):

zulipterminal/config/keys.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,11 @@
140140
'help_text': 'Narrow to all starred messages',
141141
'key_category': 'navigation',
142142
}),
143+
('ALL_MENTIONS', {
144+
'keys': {'#'},
145+
'help_text': "Narrow to messages in which you're mentioned",
146+
'key_category': 'navigation',
147+
}),
143148
('NEXT_UNREAD_TOPIC', {
144149
'keys': {'n'},
145150
'help_text': 'Next unread topic',

zulipterminal/ui.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,9 @@ def keypress(self, size: Tuple[int, int], key: str) -> Optional[str]:
164164
elif is_command_key('ALL_STARRED', key):
165165
self.model.controller.show_all_starred(self)
166166
self.body.focus_col = 1
167+
elif is_command_key('ALL_MENTIONS', key):
168+
self.model.controller.show_all_mentions(self)
169+
self.body.focus_col = 1
167170
elif is_command_key('SEARCH_PEOPLE', key):
168171
# Start User Search if not in editor_mode
169172
self.body.focus_position = 2

0 commit comments

Comments
 (0)