user_profile: Add links to group settings.

This commit adds links to open group settings from "User groups" tab
of user profile. These links are not shown to guests as they cannot
view `#groups` urls.

Fixes #25214.
This commit is contained in:
tnmkr 2024-02-20 20:42:46 +05:30 committed by Tim Abbott
parent 352dbf9387
commit ca6e0ce8c8
2 changed files with 11 additions and 1 deletions

View File

@ -204,6 +204,8 @@ function format_user_group_list_item_html(group) {
return render_user_group_list_item({
group_id: group.id,
name: group.name,
group_edit_url: hash_util.group_edit_url(group),
is_guest: current_user.is_guest,
});
}
@ -953,6 +955,10 @@ export function initialize() {
hide_user_profile();
});
$("body").on("click", "#user-profile-modal .group_list_item_link", () => {
hide_user_profile();
});
$("body").on("input", "#user-profile-streams-tab .stream-search", () => {
const $input = $("#user-profile-streams-tab .stream-search");
if ($input.val().trim().length > 0) {

View File

@ -1,5 +1,9 @@
<tr data-group-id="{{group_id}}">
<td class="group_list_item">
{{name}}
{{#if is_guest}}
{{name}}
{{else}}
<a class="group_list_item_link" href="{{group_edit_url}}">{{name}}</a>
{{/if}}
</td>
</tr>