mirror of
https://github.com/zulip/zulip.git
synced 2025-11-02 21:13:36 +00:00
Before this change, on clicking a checkbox to toggle subscription to a stream no UI feedback was shown and users could toggle the checkbox multiple times to send multiple requests causing bugs. This commit initializes a spinner on clicking the checkbox, to provide a UI feedback to the user. This commit also disables the checkbox once a request for subscription has been sent and re-enables the checkbox only after a response. This change has been accomplished by introducing a div to display the spinner in subscription.hbs. The corresponding styles for the spinner have been added in subscriptions.scss. The ajaxSubscribe & ajaxUnsubscribe functions in subs.js have been updated to show & hide the spinners for the time the request is in process. An additional parameter, the concerned stream object is passed to these functions( through the sub_or_unsub function) to get the location where the spinner is to be displayed. Finally, the checkbox click handler is updated to support these changes. The testing for this has been done by adding a wait of 2 secs in actions.py for the response. This gives sufficient time to test the working manually. Also, for error cases an error has been sent from action.py and the behaviour has been manually observed. Fixes #14481.