-
-
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
bugfix: Update stream-setting checkboxes from subscription events. #981
base: main
Are you sure you want to change the base?
Conversation
I'm wary from the description that a polling approach is the way to go with this, but rather that we do something like register a callback when opening the popup, which is triggered on events. That could be the starting point for a shift in how we glue parts of the application together, including loosening the coupling between the model and UI. |
dec5b36
to
4fc75a7
Compare
I have changed my approach from polling to callback-based. This works well as a v1, but I need some feedback on improvement so that I can generalize this for other UI elements that depend on events for updation.
|
This commit adds a function in StreamInfoView that runs asynchronously at regular interval checking and updating the checkboxes. The function is not yet executed from the StreamInfo view, because it doesnt yet have the logic to stop the asynch function.
This commit adds two new functions in model.py: - register_callback(): That registers callbacks for UI elements and stores them in model.callbacks data-structure. - process_callback(): That processes the corresponding callback that are already registered after getting triggered from events. These combined allow us to dynamically update the checkboxes in stream_info popup after receiving events. Fixes zulip#747.
4fc75a7
to
b2defda
Compare
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 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 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 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 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 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 #981 that deals with updating these checkboxes dynamically while the popup is still open. Tests amended. Fixes #887.
Heads up @zee-bit, 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 |
This PR fixes the mismatch between stream settings if the
StreamInfo
popup is opened in ZT and subscription events are received from the server. The current approach registers a callback when theStreamInfoView
is opened and looks forsubscription
events to trigger the callback, which in turn updates the checkbox UI.Fixes #747.