Skip to content

Commit

Permalink
Fixed DisplayGroupUsersView.group_title when `DisplayGroupUsersView…
Browse files Browse the repository at this point in the history
….short=True` and group title contains several parenthesis.
  • Loading branch information
gbastien committed May 10, 2024
1 parent 112d3ff commit 849c5a7
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
5 changes: 3 additions & 2 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@ Changelog
1.50 (unreleased)
-----------------

- Nothing changed yet.

- Fixed `DisplayGroupUsersView.group_title` when `DisplayGroupUsersView.short=True`
and group title contains several parenthesis.
[gbastien]

1.49 (2024-04-10)
-----------------
Expand Down
6 changes: 4 additions & 2 deletions src/collective/contact/plonegroup/browser/tables.py
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ def group_title(self, group):
if self.short:
splitted = group_title.split('(')
if len(splitted) > 1:
group_title = group_title.split('(')[-1][:-1]
group_title = group_title.split('(', 1)[-1][:-1]
return html.escape(group_title)

def _get_groups_and_members(self, group, index=0, keep_subgroups=False):
Expand Down Expand Up @@ -218,7 +218,9 @@ def group_users(self, group):
for index, principal in self._get_groups_and_members(group, keep_subgroups=self.is_manager):
# member may be a user or group
isGroup = base_hasattr(principal, 'isGroup') and principal.isGroup() or 0
principal_title = html.escape(principal.getProperty('fullname') or principal.getProperty('title') or principal.getId())
principal_title = html.escape(principal.getProperty('fullname') or
principal.getProperty('title') or
principal.getId())
if self.is_manager:
principal_title = principal_title + " ({0})".format(principal.id)
principal_title = "<div class='user-or-group user-or-group-level-{0}'>{1}</div>".format(
Expand Down

0 comments on commit 849c5a7

Please sign in to comment.