Stop private pages from breaking display of snippets in moderation dashboard

Fixes #10819
pull/10825/head
Matt Westcott 2023-08-23 16:22:12 +01:00 zatwierdzone przez LB (Ben Johnston)
rodzic 6dfa97b908
commit 2be1da6621
5 zmienionych plików z 37 dodań i 2 usunięć

Wyświetl plik

@ -15,6 +15,7 @@ Changelog
* Remove `wagtail.publish` log action on aliases when they are created from live source pages or the source page is published (Dan Braghis)
* Remove `wagtail.unpublish` log action on aliases when source page is unpublished (Dan Braghis)
* Fix: Ensure that StreamField's `FieldBlock`s correctly set the `required` and `aria-describedby` attributes (Storm Heg)
* Fix: Avoid an error when the moderation panel (admin dashboard) contains both snippets and private pages (Matt Westcott)
* Docs: Document `WAGTAILADMIN_BASE_URL` on "Integrating Wagtail into a Django project" page (Shreshth Srivastava)
* Docs: Replace incorrect screenshot for authors listing on tutorial (Shreshth Srivastava)
* Maintenance: Fix snippet search test to work on non-fallback database backends (Matt Westcott)

Wyświetl plik

@ -28,6 +28,7 @@ depth: 1
### Bug fixes
* Ensure that StreamField's `FieldBlock`s correctly set the `required` and `aria-describedby` attributes (Storm Heg)
* Avoid an error when the moderation panel (admin dashboard) contains both snippets and private pages (Matt Westcott)
### Documentation

Wyświetl plik

@ -37,7 +37,9 @@
{% locale_label_from_id obj.locale_id as locale_label %}
{% status locale_label classname="w-status--label" %}
{% endif %}
{% include "wagtailadmin/pages/listing/_privacy_indicator.html" with page=obj %}
{% if is_page %}
{% include "wagtailadmin/pages/listing/_privacy_indicator.html" with page=obj %}
{% endif %}
{% include "wagtailadmin/pages/listing/_locked_indicator.html" with page=obj %}
</div>
</td>

Wyświetl plik

@ -37,7 +37,9 @@
{% locale_label_from_id obj.locale_id as locale_label %}
{% status locale_label classname="w-status--label" %}
{% endif %}
{% include "wagtailadmin/pages/listing/_privacy_indicator.html" with page=obj %}
{% if is_page %}
{% include "wagtailadmin/pages/listing/_privacy_indicator.html" with page=obj %}
{% endif %}
{% include "wagtailadmin/pages/listing/_locked_indicator.html" with page=obj %}
</div>
{% if actions %}

Wyświetl plik

@ -23,6 +23,7 @@ from wagtail.admin.utils import (
from wagtail.models import (
GroupApprovalTask,
Page,
PageViewRestriction,
Task,
TaskState,
Workflow,
@ -3510,3 +3511,31 @@ class TestSnippetWorkflowStatusNotLockable(TestSnippetWorkflowStatus):
response = self.client.get(self.get_url("edit"))
self.assertNotContains(response, needle)
self.assertContains(response, "Save draft")
class TestDashboardWithSnippets(BaseSnippetWorkflowTests):
def setUp(self):
super().setUp()
# Ensure that the presence of private pages doesn't break the dashboard -
# https://github.com/wagtail/wagtail/issues/10819
homepage = Page.objects.filter(depth=2).first()
PageViewRestriction.objects.create(
page=homepage, restriction_type=PageViewRestriction.LOGIN
)
def test_dashboard_for_submitter(self):
self.login(self.submitter)
self.post("submit")
response = self.client.get(reverse("wagtailadmin_home"))
self.assertEqual(response.status_code, 200)
self.assertContains(response, "Your pages and snippets in a workflow")
def test_dashboard_for_moderator(self):
self.login(self.submitter)
self.post("submit")
self.login(self.moderator)
response = self.client.get(reverse("wagtailadmin_home"))
self.assertEqual(response.status_code, 200)
self.assertContains(response, "Awaiting your review")