From b0007bf5cae5654add5dcf197f07525a68eb2a2c Mon Sep 17 00:00:00 2001 From: Tim Abbott Date: Sun, 10 Sep 2023 17:09:42 -0700 Subject: [PATCH] settings: Navigate to profile to edit self in users panel. We don't have a "Manage user" tab in your own profile, so it would throw an exception to do the default thing here, and the mechanism for editing your own settings should be the main "your profile" panel, which is a bit bigger and more user-friendly. I'm not totally convinced that the extra logic for not having a "Manage user" tab is worth it; the alternative of figuring out a non-confusing label would not be terrible here. But this version is non-broken, and it'll be easy to change later if we change our mind. --- web/src/settings_users.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/web/src/settings_users.js b/web/src/settings_users.js index d37cdf86bb..660d670ed9 100644 --- a/web/src/settings_users.js +++ b/web/src/settings_users.js @@ -8,6 +8,7 @@ import render_admin_user_list from "../templates/settings/admin_user_list.hbs"; import * as blueslip from "./blueslip"; import * as bot_data from "./bot_data"; +import * as browser_history from "./browser_history"; import * as channel from "./channel"; import * as confirm_dialog from "./confirm_dialog"; import * as dialog_widget from "./dialog_widget"; @@ -740,6 +741,11 @@ function handle_edit_form($tbody) { popovers.hide_all(); const user_id = Number.parseInt($(e.currentTarget).attr("data-user-id"), 10); + if (people.is_my_user_id(user_id)) { + browser_history.go_to_location("#settings/profile"); + return; + } + const user = people.get_by_user_id(user_id); user_profile.show_user_profile(user, "manage-profile-tab"); });