\ No newline at end of file
From 86e591c94e87ed0e70a62123f29748ed433e335d Mon Sep 17 00:00:00 2001
From: H4N1L <119354421+HanilJain@users.noreply.github.com>
Date: Thu, 15 Feb 2024 11:15:18 +0530
Subject: [PATCH 2/2] fixed (#1778)
---
company/urls.py | 4 +++-
company/views.py | 24 ++++++++++++++----------
2 files changed, 17 insertions(+), 11 deletions(-)
diff --git a/company/urls.py b/company/urls.py
index e0cb9c7eb..f13d0b87d 100644
--- a/company/urls.py
+++ b/company/urls.py
@@ -1,4 +1,6 @@
from django.urls import include, path
+from django.contrib.auth.decorators import login_required
+
from company.views import (
CompanyDashboardAnalyticsView,
CompanyDashboardManageBugsView,
@@ -26,5 +28,5 @@
path("dashboard/end_bughunt/
",EndBughuntView.as_view(),name="end_bughunt"),
path("/dashboard/add_bughunt/",AddHuntView.as_view(),name="add_bughunt"),
path("/dashboard/add_domain/",AddDomainView.as_view(),name="add_domain"),
- path("domain//",DomainView.as_view(),name="view_domain"),
+ path("domain//", login_required(DomainView.as_view()),name="view_domain"),
]
\ No newline at end of file
diff --git a/company/views.py b/company/views.py
index 12b508e8c..0b0cd1e7d 100644
--- a/company/views.py
+++ b/company/views.py
@@ -551,20 +551,24 @@ def get(self,request,pk,*args,**kwargs):
total_bug_reported = Issue.objects.filter(pk=domain["id"]).count()
total_bug_accepted = Issue.objects.filter(pk=domain["id"], verified=True).count()
- # get latest reported public issues
- latest_issues = (
- Issue.objects
- .values("id","domain__name","url","description","user__id","user__username","user__userprofile__user_avatar","label","status","verified","rewarded","created__day","created__month","created__year")
- .filter(domain__id=domain["id"],is_hidden=False).order_by("-created")
- [:11]
- )
is_domain_manager = Domain.objects.filter(
Q(id=domain["id"]) &
Q(managers__in=[request.user])
).exists()
- if not is_domain_manager:
- latest_issues.filter(is_hidden=False) #show public issues to normal users
-
+ if is_domain_manager:
+ latest_issues = (
+ Issue.objects
+ .values("id","domain__name","url","description","user__id","user__username","user__userprofile__user_avatar","label","status","verified","rewarded","created__day","created__month","created__year")
+ .filter(domain__id=domain["id"]).order_by("-created")
+ [:11]
+ )
+ else :
+ latest_issues = (
+ Issue.objects
+ .values("id","domain__name","url","description","user__id","user__username","user__userprofile__user_avatar","label","status","verified","rewarded","created__day","created__month","created__year")
+ .filter(domain__id=domain["id"],is_hidden=False).order_by("-created")
+ [:11]
+ )
issue_labels = [label[-1] for label in Issue.labels]
cleaned_issues = []
for issue in latest_issues: