Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
user_profile: Fix incorrect rendering of groups and channels list.
whilstsomebody14d96bf93200
diff --git a/web/src/user_profile.ts b/web/src/user_profile.tsindex 2d306647ab6..79ef9b71f27 100644--- a/web/src/user_profile.ts+++ b/web/src/user_profile.ts@@ -537,7 +537,6 @@ export function show_user_profile(user: User, default_tab_key = "profile-tab"):original_values = {user_id: user.user_id.toString(),};- const user_streams = stream_data.get_streams_for_user(user.user_id).subscribed;// We only show the subscribe widget if the user is an admin, the user has opened their own profile,// or if the user profile belongs to a bot whose owner has opened the user profile. However, we don't// want to show the subscribe widget for generic bots since they are system bots and for deactivated users.@@ -546,7 +545,6 @@ export function show_user_profile(user: User, default_tab_key = "profile-tab"):(people.can_admin_user(user) || settings_data.user_can_subscribe_other_users()) &&!user.is_system_bot &&people.is_person_active(user.user_id);- const groups_of_user = user_groups.get_user_groups_of_user(user.user_id);// We currently have the main UI for editing your own profile in// settings, so can_manage_profile is artificially false for those.const can_manage_profile =@@ -601,6 +599,7 @@ export function show_user_profile(user: User, default_tab_key = "profile-tab"):default_tab = 3;}+ let has_initialized_user_type_fields = false;const opts = {selected: default_tab,child_wants_focus: true,@@ -619,17 +618,30 @@ export function show_user_profile(user: User, default_tab_key = "profile-tab"):);switch (key) {case "profile-tab":- initialize_user_type_fields(user);+ if (!has_initialized_user_type_fields) {+ initialize_user_type_fields(user);+ has_initialized_user_type_fields = true;+ }break;- case "user-profile-groups-tab":- render_user_group_list(groups_of_user, user);+ case "user-profile-groups-tab": {+ if (!user_groups_list_widget) {+ const groups_of_user = user_groups.get_user_groups_of_user(user.user_id);+ render_user_group_list(groups_of_user, user);+ }break;- case "user-profile-streams-tab":- if (show_user_subscribe_widget) {- render_user_profile_subscribe_widget();+ }+ case "user-profile-streams-tab": {+ if (!user_streams_list_widget) {+ const user_streams = stream_data.get_streams_for_user(+ user.user_id,+ ).subscribed;+ if (show_user_subscribe_widget) {+ render_user_profile_subscribe_widget();+ }+ render_user_stream_list(user_streams, user);}- render_user_stream_list(user_streams, user);break;+ }case "manage-profile-tab":$("#user-profile-modal .modal__footer").show();render_manage_profile_content(user);