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.
This commit is contained in:
Tim Abbott 2023-09-10 17:09:42 -07:00
parent 0174902b73
commit b0007bf5ca
1 changed files with 6 additions and 0 deletions

View File

@ -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");
});