Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
user_profile: Add tooltip to user group remove button when disabled.
Pratik Chanda44b498f96bfa
diff --git a/web/src/user_profile.ts b/web/src/user_profile.tsindex d8ba92cb2c9..3d5cfd5f6f3 100644--- a/web/src/user_profile.ts+++ b/web/src/user_profile.ts@@ -306,12 +306,25 @@ function format_user_group_list_item_html(group: UserGroup, user: User): stringconst is_direct_member = group.members.has(user.user_id);const is_me = user.user_id === current_user.user_id;const can_leave_user_group = is_me && settings_data.can_leave_user_group(group.id);+ const subgroups_name = [];+ if (!is_direct_member) {+ const subgroups = user_groups.get_direct_subgroups_of_group(group).sort(compare_by_name);+ subgroups_name.push(+ ...subgroups+ .filter((subgroup) =>+ user_groups.is_user_in_group(subgroup.id, user.user_id, false),+ )+ .map((subgroup) => subgroup.name),+ );+ }return render_user_group_list_item({group_id: group.id,name: group.name,group_edit_url: hash_util.group_edit_url(group, "general"),is_guest: current_user.is_guest,is_direct_member,+ subgroups_name: subgroups_name.join(", "),+ is_me,can_remove_members: settings_data.can_manage_user_group(group.id) || can_leave_user_group,});}diff --git a/web/templates/user_group_list_item.hbs b/web/templates/user_group_list_item.hbsindex e03edf0c2d3..50d2d5f4bad 100644--- a/web/templates/user_group_list_item.hbs+++ b/web/templates/user_group_list_item.hbs@@ -9,9 +9,11 @@{{#if can_remove_members }}<td class="remove_member"><div class="group_list_remove">- <button type="button" name="remove" class="remove-member-button button small rounded button-danger" {{#unless is_direct_member}}disabled="disabled"{{/unless}} >- {{t 'Remove' }}- </button>+ <span {{#unless is_direct_member}}class="tippy-zulip-tooltip" data-tippy-content="{{#if is_me}}{{t 'You are a member of {name} because you are a member of a subgroup ({subgroups_name}).'}} {{else}}{{t 'This user is a member of {name} because they are a member of a subgroup ({subgroups_name}).'}}{{/if}}"{{/unless}}>+ <button type="button" name="remove" class="remove-member-button button small rounded button-danger" {{#unless is_direct_member}}disabled="disabled"{{/unless}} >+ {{t 'Remove' }}+ </button>+ </span></div></td>{{/if}}