Skip to content

armgit / zulip

Public Imported from GitHub
0

Zulip server and web application. Open-source team chat that helps teams stay productive and focused.

user_profile: Accept user_id in show_user_profile.

Aman Agrawale5f8e3bad1d6
diff --git a/web/src/hashchange.ts b/web/src/hashchange.ts
index e04fda7c1d2..dd810e12cfd 100644
--- a/web/src/hashchange.ts
+++ b/web/src/hashchange.ts
@@ -517,8 +517,7 @@ function do_hashchange_overlay(old_hash: string | undefined): void {
if (!people.is_known_user_id(user_id)) {
user_profile.show_user_profile_access_error_modal();
} else {
- const user = people.get_by_user_id(user_id);
- user_profile.show_user_profile(user);
+ user_profile.show_user_profile(user_id);
}
return;
}
diff --git a/web/src/settings_account.ts b/web/src/settings_account.ts
index 74df31b5870..c27df4c9de4 100644
--- a/web/src/settings_account.ts
+++ b/web/src/settings_account.ts
@@ -915,8 +915,7 @@ export function set_up(): void {
e.stopPropagation();
e.preventDefault();
- const user = people.get_by_user_id(people.my_current_user_id());
- user_profile.show_user_profile(user);
+ user_profile.show_user_profile(people.my_current_user_id());
});
// When the personal settings overlay is opened, we reset
diff --git a/web/src/settings_users.ts b/web/src/settings_users.ts
index 7faf8ad0981..55808467a94 100644
--- a/web/src/settings_users.ts
+++ b/web/src/settings_users.ts
@@ -706,8 +706,7 @@ export function handle_edit_form($tbody: JQuery): void {
return;
}
- const user = people.get_by_user_id(user_id);
- user_profile.show_user_profile(user, "manage-profile-tab");
+ user_profile.show_user_profile(user_id, "manage-profile-tab");
});
}
diff --git a/web/src/user_card_popover.ts b/web/src/user_card_popover.ts
index 2316187cf8b..971defa4611 100644
--- a/web/src/user_card_popover.ts
+++ b/web/src/user_card_popover.ts
@@ -819,8 +819,7 @@ function register_click_handlers(): void {
// If any overlay is already open, we want the user profile to behave
// as a modal rather than an overlay.
if (is_overlay_hash(current_hash)) {
- const user = people.get_by_user_id(user_id);
- user_profile.show_user_profile(user);
+ user_profile.show_user_profile(user_id);
} else {
browser_history.go_to_location(`user/${user_id}`);
}
@@ -969,8 +968,7 @@ function register_click_handlers(): void {
$("body").on("click", ".sidebar-popover-manage-user", function () {
hide_all();
const user_id = elem_to_user_id($(this).parents("ul"));
- const user = people.get_by_user_id(user_id);
- user_profile.show_user_profile(user, "manage-profile-tab");
+ user_profile.show_user_profile(user_id, "manage-profile-tab");
});
$("body").on("click", ".edit-your-profile", () => {
diff --git a/web/src/user_profile.ts b/web/src/user_profile.ts
index 7b645eca174..2f6f9083741 100644
--- a/web/src/user_profile.ts
+++ b/web/src/user_profile.ts
@@ -692,7 +692,8 @@ function add_user_to_groups(group_ids: number[], user_id: number, $alert_box: JQ
add_user_to_next_group();
}
-export function show_user_profile(user: User, default_tab_key = "profile-tab"): void {
+export function show_user_profile(user_id: number, default_tab_key = "profile-tab"): void {
+ const user = people.get_by_user_id(user_id);
// Reset these widgets so that they are created again for the opened modal.
user_streams_list_widget = undefined;
user_groups_list_widget = undefined;