Skip to content

Commit

Permalink
User and invitation list views should show team for agent users if th…
Browse files Browse the repository at this point in the history
…at feature is enabled
  • Loading branch information
rowanseymour committed Nov 7, 2024
1 parent 4d9c47d commit 957d887
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
4 changes: 3 additions & 1 deletion temba/orgs/views/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -373,9 +373,10 @@ def get_context_data(self, **kwargs):
for user in context["object_list"]:
membership = self.request.org.get_membership(user)
user.role = membership.role
# user.team = membership.team # TODO enable this when orgs can create teams
user.team = membership.team

context["has_viewers"] = self.request.org.get_users(roles=[OrgRole.VIEWER]).exists()
context["has_teams"] = Org.FEATURE_TEAMS in self.request.org.features
context["admin_count"] = self.request.org.get_users(roles=[OrgRole.ADMINISTRATOR]).count()
return context

Expand Down Expand Up @@ -2152,6 +2153,7 @@ def build_context_menu(self, menu):
def get_context_data(self, **kwargs):
context = super().get_context_data(**kwargs)
context["validity_days"] = settings.INVITATION_VALIDITY.days
context["has_teams"] = Org.FEATURE_TEAMS in self.request.org.features
return context

class Create(RequireFeatureMixin, ModalFormMixin, OrgPermsMixin, SmartCreateView):
Expand Down
2 changes: 1 addition & 1 deletion templates/orgs/invitation_list.html
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
<td>{{ obj.email }}</td>
<td>
{{ obj.role.display }}
{% if obj.team %}({{ obj.team.name }}){% endif %}
{% if obj.team and has_teams %}({{ obj.team.name }}){% endif %}
</td>
<td>{{ obj.created_on|day }}</td>
<td class="w-10">
Expand Down
2 changes: 1 addition & 1 deletion templates/orgs/user_list.html
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
<td>{{ obj.name }}</td>
<td>
{{ obj.role.display }}
{% if obj.team %}({{ obj.team.name }}){% endif %}
{% if obj.team and has_teams %}({{ obj.team.name }}){% endif %}
</td>
<td class="w-10">
{% if obj.role.code != "A" or admin_count > 1 %}
Expand Down

0 comments on commit 957d887

Please sign in to comment.