diff --git a/CHANGELOG.md b/CHANGELOG.md index e0b75da80..934f1a70a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,26 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [v4.2.2] - 3 July 2024 + +### Added + +* Added a check to the template linter to ensure the `CodeInline` and `CodeBlock` styles have the correct style type (PR #474) + +### Changed + +* Gave every optional field in the database a default value (a blank string) to help prevent errors when creating new entries via the GraphQL API (PR #469) + +### Fixed + +* Fixed extra fields on findings not being processed for report generation (PR #467) +* Fixed project fields being processed twice when generating a report (PR #468) +* Fixed syntax errors that weren't being caught properly and returning generic failure messages (PR #470) +* Fixed observation tags missing from the linting data (PR #471) +* Fixed uploading evidence and autocomplete on observations (PR #472) +* Fixed a server error that could occur when using the `checkoutServer` and `checkoutDomain` mutations in the GraphQL API and providing a null value for the `note` field (PR #475) +* Fixed the "My Active Projects" sidebar dropdown not showing the correct message if all projects are marked as complete (PR #475) + ## [v4.2.1] - 18 June 2024 ### Changed diff --git a/VERSION b/VERSION index ac9e628cf..dfe75b0b6 100644 --- a/VERSION +++ b/VERSION @@ -1,2 +1,2 @@ -v4.2.1 -20 June 2024 +v4.2.2 +3 July 2024 diff --git a/config/settings/base.py b/config/settings/base.py index 48b435d46..9f54339d8 100644 --- a/config/settings/base.py +++ b/config/settings/base.py @@ -11,9 +11,9 @@ # 3rd Party Libraries import environ -__version__ = "4.2.1" +__version__ = "4.2.2" VERSION = __version__ -RELEASE_DATE = "20 June 2024" +RELEASE_DATE = "3 July 2024" ROOT_DIR = Path(__file__).resolve(strict=True).parent.parent.parent APPS_DIR = ROOT_DIR / "ghostwriter" diff --git a/ghostwriter/api/tests/test_views.py b/ghostwriter/api/tests/test_views.py index 1f1e041ab..e71bcc54c 100644 --- a/ghostwriter/api/tests/test_views.py +++ b/ghostwriter/api/tests/test_views.py @@ -638,7 +638,8 @@ def generate_server_data( def test_graphql_checkout_domain(self): _, token = utils.generate_jwt(self.user) - data = self.generate_domain_data(self.project.pk, self.domain.pk, self.activity.pk, note="Test note") + data = self.generate_domain_data(self.project.pk, self.domain.pk, self.activity.pk) + del data["input"]["note"] response = self.client.post( self.domain_uri, data=data, @@ -657,9 +658,8 @@ def test_graphql_checkout_domain(self): def test_graphql_checkout_server(self): _, token = utils.generate_jwt(self.user) - data = self.generate_server_data( - self.project.pk, self.server.pk, self.activity.pk, self.server_role.pk, note="Test note" - ) + data = self.generate_server_data(self.project.pk, self.server.pk, self.activity.pk, self.server_role.pk) + del data["input"]["note"] response = self.client.post( self.server_uri, data=data, diff --git a/ghostwriter/api/views.py b/ghostwriter/api/views.py index 270ed243a..fe6a258fc 100644 --- a/ghostwriter/api/views.py +++ b/ghostwriter/api/views.py @@ -592,6 +592,8 @@ def post(self, request, *args, **kwargs): return JsonResponse(utils.generate_hasura_error_payload("Domain is expired", "DomainExpired"), status=400) try: + if not self.note: + self.note = "" History.objects.create( domain=self.object, activity_type=self.activity_type, @@ -647,6 +649,8 @@ def post(self, request, *args, **kwargs): ) try: + if not self.note: + self.note = "" ServerHistory.objects.create( server=self.object, activity_type=self.activity_type, diff --git a/ghostwriter/home/templatetags/custom_tags.py b/ghostwriter/home/templatetags/custom_tags.py index 6b23f6943..fab5c4b96 100644 --- a/ghostwriter/home/templatetags/custom_tags.py +++ b/ghostwriter/home/templatetags/custom_tags.py @@ -68,24 +68,30 @@ def count_assignments(request): @register.simple_tag -def get_reports(request): +def get_assignment_data(request): """ - Get a list of all :model:`reporting.Report` entries associated with - an individual :model:`users.User` via :model:`rolodex.Project` and - :model:`rolodex.ProjectAssignment`. + Get a list of :model:`rolodex.ProjectAssignment` entries associated + with an individual :model:`users.User` and return a list of unique + :model:`rolodex.Project` entries and a list of unique :model:`reporting.Report` entries. """ + active_projects = [] active_reports = [] - active_projects = ( + + user_assignments = ( ProjectAssignment.objects.select_related("project") .filter(Q(operator=request.user) & Q(project__complete=False)) .order_by("project__end_date") ) + for assignment in user_assignments: + if assignment.project not in active_projects: + active_projects.append(assignment.project) + for active_project in active_projects: - reports = Report.objects.filter(Q(project=active_project.project) & Q(complete=False)) + reports = Report.objects.filter(Q(project=active_project) & Q(complete=False)) for report in reports: - active_reports.append(report) - - return active_reports + if report not in active_reports: + active_reports.append(report) + return active_projects, active_reports @register.simple_tag diff --git a/ghostwriter/home/tests/test_views.py b/ghostwriter/home/tests/test_views.py index 94dfab331..ec93e19b4 100644 --- a/ghostwriter/home/tests/test_views.py +++ b/ghostwriter/home/tests/test_views.py @@ -109,8 +109,11 @@ def test_tags(self): result = custom_tags.count_assignments(request) self.assertEqual(result, self.num_of_findings) - result = custom_tags.get_reports(request) - self.assertEqual(len(result), 1) + projects, reports = custom_tags.get_assignment_data(request) + self.assertEqual(len(projects), 1) + self.assertEqual(projects[0], self.project) + self.assertEqual(len(reports), 1) + self.assertEqual(reports[0], self.report) result = custom_tags.settings_value("DATE_FORMAT") self.assertEqual(result, settings.DATE_FORMAT) diff --git a/ghostwriter/templates/base_generic.html b/ghostwriter/templates/base_generic.html index fa47211dc..748e33192 100644 --- a/ghostwriter/templates/base_generic.html +++ b/ghostwriter/templates/base_generic.html @@ -131,9 +131,9 @@
@@ -160,15 +161,14 @@ @@ -226,7 +226,8 @@ {% comment %} observations Submenu Items {% endcomment %}