-
-
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
feature: Add Reactions to messages. #913
Conversation
@Ezio-Sarthak Thanks for your review. I'll update this PR after making the desired changes. 👍 Apart, from the code, I also request you to please check out the functionality, if you haven't already and report any bugs/anomalies you find, here or in CZO. This would be really helpful. 😅 |
b6b305a
to
158ac4e
Compare
179d6c3
to
4ad9330
Compare
@zulipbot add "PR needs review" |
56d424f
to
8bd8cbe
Compare
8bd8cbe
to
75f93ce
Compare
@zee-bit I'm leaving a few thoughts that came to my mind regarding the commit messages and commit structure. 1st commit: The commit title might need to be rephrased because we intend to "use" the emoji data in 2nd commit[minor]: First letter of the commit message can be capitalized. :) 3rd commit: This commit has too many changes which makes it tough to be reviewed. So, I think it would be better if we can split it into 2 or 3 commits. Maybe the first one can define Hope this helps. I am yet to go through the remaining 4 commits. |
75f93ce
to
102cc1e
Compare
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.
@zee-bit I continue to love this feature, hence decided to give more focussed feedback 👍.
Thanks for splitting the commits, it helped me a lot in understanding the whole story in the PR :)
I see that we'd prefer to include the refactors in the initial commits, though we'd also try keeping it close to the one for which we made this refactor. The refactor commit for PopUpView (2nd commit) and the introduction of EmojiPickerView (7th commit) seems to be quite a gap. (I'm not sure if there were changes based on this refactor between the commits)
I like the intent of using CHECK_MARK
for checking if a user has reacted with an emoji or not. This should be a good v0. We might also explore changing the background of emoji count for the same if that makes sense.
102cc1e
to
e7c8c9f
Compare
e7c8c9f
to
ade3ceb
Compare
5b51253
to
fa5df75
Compare
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.
@zee-bit After merging those model commits I rebased and pushed back the others for convenience. We discussed some points in the stream, and I've left some more inline.
The bugfix seems like a good early commit on the basis that the header/footer shouldn't scroll, so isn't related to fixing the behavior here but can be done first instead. With that and a few other changes as discussed I'm less concerned about the structure/flow at this point and looking forward to this 👍
zulipterminal/ui_tools/boxes.py
Outdated
if not fixed_search_caption: | ||
super().__init__(caption="", edit_text=self.search_text) |
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.
This is not being used anywhere? Everything defaults to True?
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.
Ahh... This was changed recently when we decided to remove the search hint when the user presses p
again. If we go by the current approach i.e. disappearing search hint, then I don't think we need this commit(?), but if we want to show the search caption when the user presses p
, then this will be useful.
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.
I am still convinced that we dont need to show the search hint when the user presses p
, so I've dropped this commit and moved the "initial focus in the search-box" part to the emoji picker commit earlier.
@@ -297,6 +303,7 @@ def test_keypress_emoji_button( | |||
controller=controller, | |||
emoji_unit=("+1", "1f44d", ["thumbs_up", "like"]), | |||
message=message_fixture, | |||
reaction_count=1, |
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.
Do we know enough here to assert on the reaction count after?
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.
We can't assert on the reaction_count currently, because of the below lambda functions. I can instead add case
'es to the test in the initial EmojiButton
commit and then assert on the reaction_count in this one, but that won't be "just a" keypress check anymore?
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.
I've added tests for checking reaction_count as well. Let me know if that looks complex. :)
e3c70db
to
0b2d253
Compare
881562d
to
0654ff9
Compare
0654ff9
to
9841acb
Compare
9841acb
to
3af2bd1
Compare
This commit creates an EmojiButton class in buttons.py that will be used to define button objects for each emoji to contain their properties and can be passed to emoji picker view to render them. Tests added.
This commit adds hotkeys for opening/closing of emoji picker popup, and searching for emojis from the popup. The current proposed key for opening/closing emoji popup is ':'(colon), and for searching a particular emoji from the popup is 'p'. docs/hotkeys.md regenerated.
A new pop-up EmojiPickerView will be triggered on pressing ':' key on a message. This view will be used to search and select the emoji that a user wants to toggle (react/unreact with). The selection will be applied only after exiting the popup. This currently only provides a UI for adjusting the thumbs-up/+1 emoji, as currently achievable via `+`, but will be extended in future. A minimal search-box implemented on top of PanelSearchBox is added, which can be triggered on pressing 'p' key from Emoji picker view. The search logic will be added in subsequent commits, however currently only one emoji is in the list. Tests added. Co-authored-by: Zeeshan <equbalzeeshan@gmail.com>
This commit completes the logic of searching for emojis from the EmojiPickerView on pressing 'p' key. The search is kept dynamic for faster reacting to messages. The emoji list now also displays the full list of emoji's present in model.active_emoji_data. A few bugs related to displaying empty emoji list and searching in general have also been fixed. Tests added and amended.
A new reaction_count field is added to the EmojiButton class to keep in check the number of reactions with a particular emoji on a message. The EmojiPicker view also shows the count of reactions of a particular emoji beside emoji_name, and the list is sorted in descending order of emoji_count, then in ascending order of emoji_names if the count is equal. Tests amended.
This commit adds support for handling mouse_events from the emoji picker view, so that users can toggle reactions and scroll the view using their mouse. The mouse_event looks for left-click for toggling message reactions and up/down scroll to scroll through the list of emoji's from the picker. The commit is kept at the last since having mouse support is one of our least priorities for now, and providing basic functions bug-free should always come first. Tests added.
3af2bd1
to
dc77603
Compare
@zee-bit Thanks for your work taking this to the finishing line, including the already-merged commits 👍 This took a little longer to review than I'd hoped, and things may be simpler to read if we make a few changes later, but this is a great feature and one that we've been looking forward to for some time :) The simpler logic we achieved at the end has definitely helped with readability 👍 I know there is plenty else to be getting on with, but it'd be great to discuss follow-up ideas in the stream - I know we discussed a few already, and we can perhaps write up a tracking issue to summarize afterwards. Another that came to mind is if one applies multiple reactions, then the changes already made aren't shown during subsequent searches, so 'saving' the reactions (esc/:) can cause unexpected results - maybe we could keep showing the to-be-changed reactions during a search? |
This PR packs a critical feature, that supports adding general reactions to messages. Few highlights of this feature:
EmojiPicker
popup that activates from : hotkey.CHECK_MARK
that indicates emoji's that the current user has reacted with.Working:
Thanks to @kaustubh-nair for his initial work in #707. I was able to pull some of his changes here, which simplified my work.