-
-
Notifications
You must be signed in to change notification settings - Fork 246
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
Views/BuddyView: Introduce BuddyView to show Recent PMs and Group PMs. #315
base: main
Are you sure you want to change the base?
Conversation
8a633f9
to
e266118
Compare
a178b10
to
a9e7f95
Compare
678065f
to
2447562
Compare
This comment has been minimized.
This comment has been minimized.
ea20770
to
5cea361
Compare
@neiljp I have added minimal tests for the functions and this could possibly serve as a v1 for BuddyList. Since this PR is already getting too big, I will add some feature improvements I have in mind along with more robust tests in future PRs. Thanks! |
0162d7a
to
dc1a267
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.
I don't have much time to do a complete review as this is quite large and mixed, but I've left some thoughts on the first and third, in order to give feedback sooner rather than later.
While I'm unsure right now if the current UI is the approach to go, I do like that this builds UI elements that we could use wherever we want; I hope the inheritance helps?
@@ -1244,6 +1244,7 @@ def test_text_content(self, mocker, | |||
count_str) | |||
assert len(text[0]) == len(expected_text) == (width - 1) | |||
assert text[0] == expected_text | |||
assert top_button._w._original_widget._wrap_mode == 'any' |
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.
Why is wrapping on any character better than wrapping on spaces?
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.
Primarily, to keep computation of showing unread count at the right position simple. Otherwise, we will have to take wrapping of words into account which is currently not included in the code.
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 can see that this could confuse the placement of the unread counts. That said, the styling of the words looks pretty bad if the text wraps mid-word.
I would put this 'why' into the commit title/summary in any case.
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.
Of course! done 👍
user_ids = frozenset(map(int, user_ids)) | ||
unread_counts['unread_pms'][user_ids] = count | ||
unread_counts['all_msg'] += count | ||
unread_counts['all_pms'] += count |
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.
The rest of this code builds infrastructure for testing classify_unread_counts - which is great :)
However, I would suggest putting the above additions and the changes to the tests required for it from this commit in a separate commit.
Both of those commits would then be fine in another PR?
tests/conftest.py
Outdated
@@ -350,11 +350,112 @@ def initial_data(logged_on_user): | |||
'stream_weekly_traffic': 0 | |||
}], | |||
'unread_msgs': { | |||
'pms': [], | |||
'count': 0, | |||
'pms': [{ |
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 like the addition of this extra data to the tests - but this is a lot. Is this real data you've captured? Can we trim it to base data and then parametrize to look at some cases? This looks like a lot, and while having real data is good, it makes it more difficult to understand?
Thanks @neiljp for the review I will get to them by the end of this week as I am busy with exams. |
I have split the commit as you suggested. As for the fixtures, I can curb them down but I feel they can be useful later as they provide the base for all the group_pm and unread_count related fixtures which were previously missing. |
@neiljp is this ready to merge? |
4e937a5
to
be41830
Compare
@punchagan @neiljp I have rebased this PR against master. Let me know your views on this. |
a71259b
to
4a95601
Compare
Don't space wrap the last word if it doesn't fit in the column. Instead fill part of word in one row and rest in the next row. This is done to keep computation of showing unread count at the right position simple. Otherwise, we will have to take wrapping of words into account which is currently not included in the code.
Store PM recipients in index as dict of frozenset(recipients) and Timestamp to be used in BuddyView.
Add tests and fixtures for testing classify_unread_counts.
Get unread_counts for group pms stored as 'huddles' and store them in unread_msg_counts. Add tests for classify_unread_counts along with appropriate fixtures.
This is based on TopButton except that it has multiple recipients. Add tests to check correctly rendered caption.
This includes following features: * `b` keypress toggling of BuddyView * Shows Recent PMs and Group PMs * Shows corresponding Unread Counts. * Shows Online/Idle/Offline status of users/Group PMs. core/keys: Use 'b' to toggle BuddyView. Fixes zulip#220
Allow caption to overflow to next line if `shrink=False`.
Codecov Report
@@ Coverage Diff @@
## master #315 +/- ##
==========================================
- Coverage 70.38% 68.41% -1.97%
==========================================
Files 12 12
Lines 2195 1979 -216
Branches 479 440 -39
==========================================
- Hits 1545 1354 -191
Misses 524 524
+ Partials 126 101 -25
Continue to review full report at Codecov.
|
Heads up @amanagr, we just merged some commits that conflict with the changes your made in this pull request! You can review this repository's recent commits to see where the conflicts occur. Please rebase your feature branch against the |
No description provided.