Skip to content
Snippets Groups Projects
Commit 2fb01f40 authored by Todd Dembrey's avatar Todd Dembrey Committed by Fredrik Jonsson
Browse files

Make sure the applicant can only see the determinations

parent bfb14e51
No related branches found
No related tags found
No related merge requests found
...@@ -23,7 +23,7 @@ ...@@ -23,7 +23,7 @@
- {{ activity.message }} - {{ activity.message }}
{% if not submission_title and activity.related_object %} {% if not submission_title and activity|user_can_see_related:request.user %}
{% with url=activity.related_object.get_absolute_url %} {% with url=activity.related_object.get_absolute_url %}
{% if url %} {% if url %}
<a href="{{ url }}" class="feed__related-item"> <a href="{{ url }}" class="feed__related-item">
......
from django import template from django import template
from opentech.apply.determinations.models import Determination
from opentech.apply.review.models import Review from opentech.apply.review.models import Review
register = template.Library() register = template.Library()
...@@ -14,3 +15,17 @@ def display_author(activity, user): ...@@ -14,3 +15,17 @@ def display_author(activity, user):
): ):
return 'Reviewer' return 'Reviewer'
return activity.user return activity.user
@register.filter
def user_can_see_related(activity, user):
if not activity.related_object:
return False
if user.is_apply_staff:
return True
if isinstance(activity.related_object, Determination):
return True
return False
...@@ -34,9 +34,13 @@ class ActivityContextMixin: ...@@ -34,9 +34,13 @@ class ActivityContextMixin:
extra = { extra = {
'actions': Activity.actions.filter(submission=self.object).select_related( 'actions': Activity.actions.filter(submission=self.object).select_related(
'user', 'user',
).prefetch_related(
'related_object',
).visible_to(self.request.user), ).visible_to(self.request.user),
'comments': Activity.comments.filter(submission=self.object).select_related( 'comments': Activity.comments.filter(submission=self.object).select_related(
'user', 'user',
).prefetch_related(
'related_object',
).visible_to(self.request.user), ).visible_to(self.request.user),
} }
......
...@@ -115,7 +115,7 @@ ...@@ -115,7 +115,7 @@
width: 10px; width: 10px;
height: 14px; height: 14px;
margin-left: 10px; margin-left: 10px;
margin-top: 0.25em; margin-top: 0.35em;
fill: $color--dark-blue; fill: $color--dark-blue;
} }
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment