-
-
Notifications
You must be signed in to change notification settings - Fork 250
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
Add manual cycling of random hints in footer #1517
Conversation
77bbb59
to
f8d1ee5
Compare
Hello @zulip/server-hotkeys members, this pull request was labeled with the "area: hotkeys" label, so you may want to check it out! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! The use of freezegun
is an interesting approach. Tested it manually too, works as intended 👍
Well done, @Niloth-p! I've left a few comments, nothing major though.
docs/hotkeys.md
Outdated
@@ -13,6 +13,7 @@ | |||
|Redraw screen|<kbd>Ctrl</kbd> + <kbd>l</kbd>| | |||
|Quit|<kbd>Ctrl</kbd> + <kbd>c</kbd>| | |||
|Show/hide user information (from users list)|<kbd>i</kbd>| | |||
|Next footer hint|<kbd>Tab</kbd>| |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
NIT: Since the footer hints are random, should we rename this to "New footer hint" or "Random footer hint" instead?
That said, "Next footer hint" seems perfectly fine too.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure, we could totally go with that. That would be better indeed, at this point.
I was actually thinking of adding functionality to go back to the previous hint as well, but it's too early to decide, I suppose, as it would depend on other features that are yet to be implemented like the hint priority field.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, that makes sense. In that case, it's probably best to keep it as is.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nah, I've added a new commit updating it already :)
We could change it to "Next" if and when we add the functionality for going to previous hint.
tests/ui/test_ui.py
Outdated
# Trigger the alarm | ||
alarm_callback = mocked_alarm.call_args[0][1] | ||
alarm_callback(None, None) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If I understand correctly, line 123 is simulating the alarm going off (?) and triggering the callback function. (Correct me if I'm wrong)
Could we make the comment on that line more specific about this to prevent any confusion? We could start the comment with # NOTE:
similar to how it's done elsewhere.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, the comment is meant to convey that the code below is to trigger the alarm, i.e directly call the callback function. I wasn't completely sure if it's required, just something that I would personally find convenient, if I was reading the code.
Ok, I'll clarify that, thank you for the feedback. Would "Directly trigger the alarm's callback function" be a better description?
Ah, we do seem to have a few comments with #NOTE:
in that file, but generally in the codebase, we don't use it that much. Not sure what the convention is regarding its usage in our repo. There doesn't seem to be a global convention. So, I'll wait to hear from the others regarding that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for the review, Sashank!
tests/ui/test_ui.py
Outdated
# Trigger the alarm | ||
alarm_callback = mocked_alarm.call_args[0][1] | ||
alarm_callback(None, None) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, the comment is meant to convey that the code below is to trigger the alarm, i.e directly call the callback function. I wasn't completely sure if it's required, just something that I would personally find convenient, if I was reading the code.
Ok, I'll clarify that, thank you for the feedback. Would "Directly trigger the alarm's callback function" be a better description?
Ah, we do seem to have a few comments with #NOTE:
in that file, but generally in the codebase, we don't use it that much. Not sure what the convention is regarding its usage in our repo. There doesn't seem to be a global convention. So, I'll wait to hear from the others regarding that.
docs/hotkeys.md
Outdated
@@ -13,6 +13,7 @@ | |||
|Redraw screen|<kbd>Ctrl</kbd> + <kbd>l</kbd>| | |||
|Quit|<kbd>Ctrl</kbd> + <kbd>c</kbd>| | |||
|Show/hide user information (from users list)|<kbd>i</kbd>| | |||
|Next footer hint|<kbd>Tab</kbd>| |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure, we could totally go with that. That would be better indeed, at this point.
I was actually thinking of adding functionality to go back to the previous hint as well, but it's too early to decide, I suppose, as it would depend on other features that are yet to be implemented like the hint priority field.
I left some notes in the channel, but getting the first commit merged with an adjusted key would be great as a first step. The remainder could be useful, particularly since refactoring to make it clearer to understand could benefit if we keep the timed approach, but could also depend on the style of help hints we settle on when they're more contextual. |
f9f076a
to
c74e3bb
Compare
Added tests. Hotkeys document regenerated.
c74e3bb
to
0a11a56
Compare
@Niloth-p Thanks for the quick PR adjust, which I only just noticed. The only change I made was to make it clearer that the 'hint' being referred to is an regard to a hotkey :) |
What does this PR do, and why?
Enables cycling through random hints in the footer.
This is in preparation to #1484, where we add contexts and the footer displays only the context-specific hotkey hints.
Outstanding aspect(s)
Tab
, but that's subject to change on discussion.External discussion & connections
Adding context to hotkeys
,Cycling through footer hints
, T1484's reviewHow did you test this?
Self-review checklist for each commit