-
-
Notifications
You must be signed in to change notification settings - Fork 251
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
[WIP] Add DM panel to the left side view. #1416
base: main
Are you sure you want to change the base?
Conversation
679c692
to
748cb4a
Compare
1d41edd
to
0739bc6
Compare
0739bc6
to
8d75162
Compare
63f5180
to
e36508e
Compare
Heads up @theViz343, we just merged some commits that conflict with the changes you 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 |
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.
@theViz343 I'd tested this previously for UX feedback, but not looked at the code in depth, until now :)
The DM Panel logic isn't quite complete functionally from what I remember, so I've focused on seeing if we can get some early commits from this PR which prepare for that work merged sooner, which is the first 3 commits.
Running the PR at that point appears to work broadly fine, with the new separate count and the stream and topic lists working as expected.
As per a comment, I'd drop the shortcut key text until the later DM-related commits, otherwise if we do a partial merge it's confusing - S is still set up to do a contextual change of narrow at that point.
Related to that, functionally there is a nit that we shouldn't be narrowing to all messages from the stream messages button - if anything, we should be narrowing to all non-DMs, but that's not implemented. At this point, you could make the button non-selectable instead. That may be relevant for the later commits, since we've not discussed the distinction between using the hotkeys (P,S) to switch panels vs ones to go to those narrows themselves - like P currently does.
In general the commits I looked at are good, but as per some comments, they might benefit from splitting/reordering. I did manage to trigger an exception when running at the first commit, since the button didn't yet exist.
@@ -225,6 +226,7 @@ def _set_count_in_view( | |||
user_buttons_list = controller.view.user_w.users_btn_list | |||
all_msg = controller.view.home_button | |||
all_pm = controller.view.pm_button | |||
all_stream = controller.view.stream_button |
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.
At this commit, this stream_button doesn't exist.
This set_count-related code likely wants to go after a skeleton UI with no count, so the button is there, and then once hooked up the count can be visible.
], | ||
ids=[ | ||
"mute_private_stream_mute_general_stream_topic", | ||
"mute_general_stream_mute_private_stream_topic", | ||
"no_mute_some_other_stream_muted", | ||
"mute_general_stream_topic", |
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.
More of a note for later, but this test is not the easiest to validate - but that's historical rather than this commit. I can see this being refactored, but unreads are a complex aspect as it is.
@@ -142,6 +142,18 @@ def __init__(self, *, controller: Any, count: int) -> None: | |||
) | |||
|
|||
|
|||
class StreamPanelButton(TopButton): | |||
def __init__(self, *, controller: Any, count: int) -> None: | |||
button_text = "Stream messages [S]" |
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 [S]
shouldn't be advertised until that hotkey is available in its new role, which will be much later, when we enable the swapping between the DM and stream panels.
class StreamPanel(urwid.Pile): | ||
def __init__(self, submenu_view: List[Any], view: Any) -> None: | ||
self.view = view | ||
count = self.view.model.unread_counts.get("all_stream_msg", 0) |
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.
As per another comment, you need the stream_button first, to handle updates.
So, until the unread count tracking is working, the count can be left at zero; in doing that, the Stream messages will look like a title.
When the tracking is complete, you can then do a small commit, or part of another, which hooks the parts together.
zulipterminal/ui_tools/views.py
Outdated
w = urwid.LineBox( | ||
self.view.stream_p, | ||
tlcorner=COLUMN_TITLE_BAR_LINE, | ||
tline=COLUMN_TITLE_BAR_LINE, | ||
trcorner=COLUMN_TITLE_BAR_LINE, |
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.
Would it be simpler to make this a Divider in the left column?
title="Topics", | ||
title_attr="column_title", | ||
tlcorner=COLUMN_TITLE_BAR_LINE, | ||
tline=COLUMN_TITLE_BAR_LINE, | ||
trcorner=COLUMN_TITLE_BAR_LINE, |
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 looks independent of this particular commit, and maybe belongs in the previous commit?
Also, this change essentially sets all the borders to be empty?
This commit reworks the stream view section in the left sidebar by replacing it with the new Stream Panel widget. The stream panel consists of the newly added stream messages button (StreamPanelButton), and the existing stream/topic view section. Test added, updated and renamed.
This commit adds a label parameter to the PanelSearchBox to provide context to the user which searching the streams/topics list. Tests updated.
This commit adds an all_streams key to the UnreadCounts dict to store the unread stream messages count. This is subsequently used by the StreamPanelButton in the stream panel. Test case added and tests updated.
19ee960
to
1f00420
Compare
This commit adds a list of recent direct messages for the user to the ZT model (recent_dms). It also adds a _sort_recent_dms function to keep the list in sorted order according to the max_message_id of the dm. Fixture added and test updated.
This commit adds an _update_recent_dms method which updates the recent_dms list when a message event is received. It keeps the list in sorted order as well. Tests modified.
This commit reworks the direct messages button by moving it to a different section between the menu and the streams panel. It also adds a direct messages panel which shows all DM recipients.
1f00420
to
76ca074
Compare
The recent update to this PR addresses most of the earlier feedback. The commits are now reordered so that the unread count functionality for the Stream Panel Button is added after the button's introduction. I've removed the I've also addressed the focus position issue. Now, the earlier focused position should be focused on when folding/unfolding panels. I've also added the user presence status to the DMButtons. A thing to note is that a DMButton is quite close in UI and functionality, to the UserButton class, with some differences such as the UserInfoView on pressing There are still a few tests to be added to cover the new code, but any initial testing is welcome :) |
Heads up @theViz343, we just merged some commits that conflict with the changes you 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 |
What does this PR do, and why?
This PR is currently preparation for the addition of a collapsible DM panel in the left side UI view.
Outstanding aspect(s)
External discussion & connections
Private messages sidepanel
How did you test this?
Self-review checklist for each commit
Visual changes