Skip to content
This repository was archived by the owner on Feb 21, 2022. It is now read-only.

Commit 4426650

Browse files
paveldedikaexvir
authored andcommitted
fix(auditing): Return 404 on detail page when there is no repo
1 parent 901eadb commit 4426650

File tree

1 file changed

+20
-18
lines changed

1 file changed

+20
-18
lines changed

zoo/auditing/views.py

Lines changed: 20 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -212,24 +212,26 @@ def get_context_data(self, **kwargs):
212212

213213
deleted_issues = []
214214

215-
if project.repository:
216-
for issue in (
217-
project.repository.issues.filter(deleted=False)
218-
.exclude(
219-
status__in=[
220-
models.Issue.Status.FIXED.value,
221-
models.Issue.Status.NOT_FOUND.value,
222-
models.Issue.Status.WONTFIX.value,
223-
]
224-
)
225-
.filter(kind_key__in=KINDS) # filter out removed issue kinds
226-
):
227-
if issue.deleted:
228-
# deleting issues still present in KINDS but not relevant
229-
# for the repository anymore
230-
deleted_issues.append(issue)
231-
232-
context["issues"][issue.kind.category].append(issue)
215+
if project.repository is None:
216+
raise Http404("Repository.DoesNotExist")
217+
218+
for issue in (
219+
project.repository.issues.filter(deleted=False)
220+
.exclude(
221+
status__in=[
222+
models.Issue.Status.FIXED.value,
223+
models.Issue.Status.NOT_FOUND.value,
224+
models.Issue.Status.WONTFIX.value,
225+
]
226+
)
227+
.filter(kind_key__in=KINDS) # filter out removed issue kinds
228+
):
229+
if issue.deleted:
230+
# deleting issues still present in KINDS but not relevant
231+
# for the repository anymore
232+
deleted_issues.append(issue)
233+
234+
context["issues"][issue.kind.category].append(issue)
233235

234236
# with defaultdict {{ issues.items }} would be empty, and we want consistent issue order anyway
235237
context["issues"] = OrderedDict(

0 commit comments

Comments
 (0)