Skip to content

Commit

Permalink
List Admins that are also Locale Managers or Translators as members o…
Browse files Browse the repository at this point in the history
…f these groups in the Locale Contributors page (#3036)
  • Loading branch information
mathjazz authored Nov 29, 2023
1 parent c41639d commit e4e3fce
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
8 changes: 4 additions & 4 deletions pontoon/base/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -251,14 +251,14 @@ def user_role(self, managers=None, translators=None):


def user_locale_role(self, locale):
if self.is_superuser:
return "Admin"
if self.pk is None or self.profile.system_user:
return "System User"
if self in locale.managers_group.user_set.all():
return "Manager"
if self in locale.translators_group.user_set.all():
return "Translator"
if self.is_superuser:
return "Admin"
if self.pk is None or self.profile.system_user:
return "System User"
else:
return "Contributor"

Expand Down
4 changes: 4 additions & 0 deletions pontoon/base/tests/models/test_user.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,3 +56,7 @@ def test_user_locale_role(user_a, user_b, user_c, locale_a):
# Manager
locale_a.managers_group.user_set.add(user_c)
assert user_c.locale_role(locale_a) == "Manager"

# Admin and Manager
locale_a.managers_group.user_set.add(user_a)
assert user_a.locale_role(locale_a) == "Manager"

0 comments on commit e4e3fce

Please sign in to comment.