From eb23c333855fd6fcdb82b766cc72a4a61c9f27ac Mon Sep 17 00:00:00 2001 From: H4N1L <119354421+HanilJain@users.noreply.github.com> Date: Thu, 15 Feb 2024 11:12:26 +0530 Subject: [PATCH 1/2] Drop Down Feature (#1776) --- poetry.lock | 2 +- website/templates/includes/header.html | 134 ++++++++++++++++++++----- 2 files changed, 108 insertions(+), 28 deletions(-) diff --git a/poetry.lock b/poetry.lock index 8269624f2..60ed67abb 100644 --- a/poetry.lock +++ b/poetry.lock @@ -2300,4 +2300,4 @@ files = [ [metadata] lock-version = "2.0" python-versions = "3.11.2" -content-hash = "e1bf23d9e7c594ae51bda6e3ef09ac7ab6e9cb076faa650a35e68a49af01e6d4" +content-hash = "eea0a20310e7ecfb191cb2f70632c5335970266a5afd132b37e4310f20d9d540" diff --git a/website/templates/includes/header.html b/website/templates/includes/header.html index ad9f030e2..5edceca26 100644 --- a/website/templates/includes/header.html +++ b/website/templates/includes/header.html @@ -11,8 +11,38 @@ color: black; } + + + \ 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: