From df43d6d99e1774ecdde0cb2f9a7f695f981fa716 Mon Sep 17 00:00:00 2001 From: sahil839 Date: Fri, 28 May 2021 00:31:49 +0530 Subject: [PATCH] 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 d50462568ba9aa 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. --- static/js/subs.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/static/js/subs.js b/static/js/subs.js index f0faa98077..5365ee271a 100644 --- a/static/js/subs.js +++ b/static/js/subs.js @@ -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(