stream_edit: Fix bug of disabling of "Add" button on subscribing.

We live update the "Add subscribers" UI on subscribing/unsubscribing
the stream and the field sub.can_add_subscribers is used to check
whether user is allowed to add subscribers or not.

The sub object used here is not the complete sub object and thus
sub.can_add_subscribers is undefined. We need to use the updated
sub obejcts with all the setting fields that we can get from
'stream_settings_data.get_sub_for_settings' before rendering UI.

This calculation of additional fields was done previously by
'stream_data.update_calculated_fields', but in d50462568b
call to 'updated_calculated_fields' was removed with the aim to
call 'get_sub_for_settings' before updating UI which was missed
in this part of UI update.

Fixes #18616.
This commit is contained in:
sahil839 2021-05-28 00:31:49 +05:30 committed by Tim Abbott
parent e2654b7154
commit df43d6d99e
1 changed files with 2 additions and 1 deletions

View File

@ -284,7 +284,8 @@ export function remove_stream(stream_id) {
}
}
export function update_settings_for_subscribed(sub) {
export function update_settings_for_subscribed(slim_sub) {
const sub = stream_settings_data.get_sub_for_settings(slim_sub);
stream_ui_updates.update_add_subscriptions_elements(sub);
$(
`.subscription_settings[data-stream-id='${CSS.escape(