-
-
Notifications
You must be signed in to change notification settings - Fork 263
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
model/views: Add notification checkboxes in Stream Info popup. #900
Conversation
3691fc4
to
12d2537
Compare
@zulipbot add "PR needs review" |
0934814
to
c0d22b6
Compare
68c3cdf
to
c3c6206
Compare
c3c6206
to
58d970e
Compare
This commit adds new command-line arguments for notify and no-notify that corresponds to desktop notifications being enabled or disabled in the current session, respectively. This should allow the user to specify a notify option and override its corresponding value in the zuliprc. This commit is a potential prep for #900, that enables modifying Stream notification settings in a running session. Tests added.
58d970e
to
460281c
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 Thanks for working on this! This seems to work well locally for the most part. 👍
This looks good overall. However, I think we would benefit from a discussion on the public stream regarding how should we present to the end-users that ZT is currently relying on the Desktop Notifications settings. And, most importantly that toggling notification settings in ZT would affect Desktop Notifications directly.
I have left a couple of in-line comments. This currently doesn't handle updates while the StreamInfoView
is active.
460281c
to
e23e4bf
Compare
e23e4bf
to
40d829b
Compare
This commit stores all subscribed streams that have desktop_notifications enabled to model's visual_notified_streams instance variable. We use a set data-structure to store since the stream_id would be unique and we do not need to sort it like pinned_streams. Tests amended.
We add a helper function in model, is_visual_notifications_enabled(), that accepts a stream_id as argument and checks if the stream has visual desktop notifications turned on, which is indicated by the "desktop_notifications" field in the Subscription data. Tests added.
Tests amended.
This commit adds handling for subscription events related to desktop_notifications. The model._handle_subscription_events now also checks for events with change in "desktop_notifications" property and adds/removes those streams from model.visual_notified_streams variable depending on the value specified in the event. This allows the model to stay in sync with the server for changes in visual notified streams. Tests added. Code & test cases for adding-existing/removing-absent ids by neiljp.
This commit adds a helper function in model to send toggle requests to the server for "desktop_notifications" field of subscription data. This function accepts a stream_id for which desktop_notifications are to be toggled, then checks the current status of the field with model.is_visual_notifications_enabled and then sends the appropriate toggle request to the server. Tests added.
This commit adds a new checkbox 'Visual desktop notification' in the Stream settings section inside StreamInfoView. It uses model's visual_notified_streams to get the initial state of the checkbox and henceforth events to sync the "desktop notifications" data between ZT <-> server. The checkboxes are not updated dynamically after events but the underlying data structure gets updated, hence re-opening the StreamInfo view will display the correct state. We have a WIP PR zulip#981 that deals with updating these checkboxes dynamically while the popup is still open. Tests amended. Fixes zulip#887.
This commit adds a "widget_disabled" style for all themes that could be passed as a Display attribute to any widget which needs to be disabled for certain cases. This atttribute can be coupled with urwid.WidgetDisable to effectively produce a completely disabled widget both visually and functionally. This renders the widget foreground in DARK_GRAY in most themes and the background is kept as the default theme background. For 1-bit color-depth the widget will render with a strikethrough.
This commit disables the "Visual desktop notification" checkbox when notify is disabled i.e. when --notify is not passed as CL arg. It wraps the widget in urwid.WidgetDisable decoration class and uses the "widget_disabled" display attribute to render a completely disabled checkbox, both visually and functionally.
40d829b
to
070dee8
Compare
@zee-bit Thanks for working on this - this is really clean and it's great to have another configuration option available 👍 We discussed splitting the solution to #666 into a separate PR (there was a part in this PR originally), but we also shouldn't forget the adjustment of the stream notification text to explain the disabling of the checkbox - might be worth addressing that first since it's likely small? |
Gradually Fixes #887.