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: Redirect edit pencil to manage user tab.

palashb01c6bb7b916942
diff --git a/web/src/user_profile.js b/web/src/user_profile.js
index b5a589c1d30..36aa9ad4b7f 100644
--- a/web/src/user_profile.js
+++ b/web/src/user_profile.js
@@ -33,6 +33,7 @@ import * as util from "./util";
let user_streams_list_widget;
let user_profile_subscribe_widget;
+let toggler;
function compare_by_name(a, b) {
return util.strcmp(a.name, b.name);
@@ -265,6 +266,10 @@ export function hide_user_profile() {
overlays.close_modal_if_open("user-profile-modal");
}
+function show_manage_user_tab(target) {
+ toggler.goto(target);
+}
+
function initialize_user_type_fields(user) {
// Avoid duplicate pill fields, by removing existing ones.
$("#user-profile-modal .pill").remove();
@@ -321,6 +326,7 @@ export function show_user_profile(user, default_tab_key = "profile-tab") {
user_type: people.get_user_type(user.user_id),
user_is_guest: user.is_guest,
show_user_subscribe_widget,
+ can_manage_profile,
};
if (user.is_bot) {
@@ -394,7 +400,8 @@ export function show_user_profile(user, default_tab_key = "profile-tab") {
opts.values.push(manage_profile_tab);
}
- const $elem = components.toggle(opts).get();
+ toggler = components.toggle(opts);
+ const $elem = toggler.get();
$elem.addClass("large allow-overflow");
$("#tab-toggle").append($elem);
if (show_user_subscribe_widget) {
@@ -519,10 +526,20 @@ export function register_click_handlers() {
e.stopPropagation();
e.preventDefault();
});
+
+ $("body").on(
+ "click",
+ "#user-profile-modal #name #user_profile_manage_others_edit_button",
+ (e) => {
+ show_manage_user_tab("manage-profile-tab");
+ e.stopPropagation();
+ e.preventDefault();
+ },
+ );
/* These click handlers are implemented as just deep links to the
* relevant part of the Zulip UI, so we don't want preventDefault,
* but we do want to close the modal when you click them. */
- $("body").on("click", "#user-profile-modal #name .user_profile_edit_button", () => {
+ $("body").on("click", "#user-profile-modal #name #user_profile_manage_own_edit_button", () => {
hide_user_profile();
});
diff --git a/web/styles/popovers.css b/web/styles/popovers.css
index edf30adb421..05f450c6daa 100644
--- a/web/styles/popovers.css
+++ b/web/styles/popovers.css
@@ -459,9 +459,11 @@ ul {
}
}
- .user_profile_edit_button {
+ #user_profile_manage_own_edit_button,
+ #user_profile_manage_others_edit_button {
width: 25px;
text-align: center;
+ font-size: 18px;
}
.user_profile_name {
@@ -472,10 +474,6 @@ ul {
padding: 3px 0 0;
}
- #user_profile_edit_button_icon {
- font-size: 18px;
- }
-
#default-section {
vertical-align: top;
diff --git a/web/templates/user_profile_modal.hbs b/web/templates/user_profile_modal.hbs
index f6a26464b69..b1dd8e90bd6 100644
--- a/web/templates/user_profile_modal.hbs
+++ b/web/templates/user_profile_modal.hbs
@@ -10,12 +10,15 @@
<h1 class="modal__title user_profile_name_heading" id="name">
<span class="user_profile_name">{{full_name}}</span>
{{#if is_bot}}
- <i class="zulip-icon zulip-icon-bot" aria-hidden="true"></i>
+ <i class="zulip-icon zulip-icon-bot" aria-hidden="true"></i>
{{/if}}
{{#if is_me}}
- <a href="/#settings/profile" class="user_profile_edit_button">
- <i class="fa fa-edit" id="user_profile_edit_button_icon" aria-hidden="true"></i>
- </a>
+ <a href="/#settings/profile">
+ <i class="fa fa-edit" id="user_profile_manage_own_edit_button" aria-hidden="true"></i>
+ </a>
+ {{/if}}
+ {{#if can_manage_profile}}
+ <i class="fa fa-edit" id="user_profile_manage_others_edit_button" aria-hidden="true"></i>
{{/if}}
</h1>
<button class="modal__close" aria-label="{{t 'Close modal' }}" data-micromodal-close></button>