Skip to content

Commit

Permalink
Fix logic according to reviews
Browse files Browse the repository at this point in the history
  • Loading branch information
m6121 committed Feb 22, 2023
1 parent 06d1947 commit a01ecfd
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{% load i18n %}
{% load rules %}
{% load projects_tags %}

{% if can_change_project %}
Expand All @@ -13,8 +14,10 @@
{% for node in project_tree %}
<li>
{% projects_indent node.level %}
{% if node.id in user_project_family_ids %}
<a href="{% url 'project' node.id %}">

{% has_perm 'projects.view_project_object' request.user node as can_view_parent_project %}
{% if can_view_parent_project %}
<a href="{% url 'project' node.id %}">
{% if node.id == project.id %}
<strong>{{ node.title }}</strong>
{% else %}
Expand Down
8 changes: 5 additions & 3 deletions rdmo/projects/views/project.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,9 +126,11 @@ def get_context_data(self, **kwargs):
.filter_catalog(self.object.catalog) \
.filter_group(self.request.user) \
.filter_availability(self.request.user).exists()
context['ancestors_import'] = ancestors.filter_user(user=self.request.user) \
.exclude(id=project.id)
context['user_project_family_ids'] = project.get_family().filter_user(user=self.request.user).values_list('id', flat=True)
ancestors_import = []
for instance in ancestors.exclude(id=project.id):
if self.request.user.has_perm('projects.view_project_object', instance):
ancestors_import.append(instance)
context['ancestors_import'] = ancestors_import
context['memberships'] = memberships.order_by('user__last_name', '-project__level')
context['integrations'] = integrations.order_by('provider_key', '-project__level')
context['providers'] = get_plugins('PROJECT_ISSUE_PROVIDERS')
Expand Down

0 comments on commit a01ecfd

Please sign in to comment.