Skip to content

Fix alias of draft page shows edit form #13210

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 13, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.txt
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@
* Fix: Make sure the label of panel collapse buttons is translatable (Thibaud Colas)
* Fix: Ensure there is suitable padding for large numbers on pagination within universal listings (M. Sumair Khokhar)
* Fix: Use the correct localized format utils in the `human_readable_date` template tag (Seb Corbin)
* Fix: Ensure the editing of translation alias pages correctly shows links to the source page if the alias was created from a draft (Dan Braghis)
* Docs: Add missing tag library imports to footer template code in tutorial (Dimaco)
* Docs: Improve documentation around securing user-uploaded files (Jake Howard)
* Docs: Introduce search_fields in a dedicated tutorial section instead of the introduction (Matt Westcott)
Expand Down
1 change: 1 addition & 0 deletions docs/releases/7.1.md
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ For more details, see the documentation on [enabling the user bar](headless_user
* Make sure the label of panel collapse buttons is translatable (Thibaud Colas)
* Ensure there is suitable padding for large numbers on pagination within universal listings (M. Sumair Khokhar)
* Use the correct localized format utils in the `human_readable_date` template tag (Seb Corbin)
* Ensure the editing of translation alias pages correctly shows links to the source page if the alias was created from a draft (Dan Braghis)

### Documentation

Expand Down
1 change: 1 addition & 0 deletions wagtail/actions/create_alias.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@ def _create_alias(
"path",
"index_entries",
"postgres_index_entries",
"latest_revision", # for page aliases do not have revisions
]

update_attrs = {
Expand Down
25 changes: 25 additions & 0 deletions wagtail/admin/tests/pages/test_edit_page.py
Original file line number Diff line number Diff line change
Expand Up @@ -2139,6 +2139,31 @@ def test_edit_alias_page(self):
html=True,
)

def test_edit_alias_page_from_draft_page(self):
# Ensure we have at least one revision. This is what happens when creating
# a page via the admin. It is stored as latest_revision
self.unpublished_page.save_revision()
alias_page = self.unpublished_page.create_alias(update_slug="an-alias-page")
response = self.client.get(
reverse("wagtailadmin_pages:edit", args=[alias_page.id])
)

self.assertEqual(response.status_code, 200)
self.assertEqual(response["Content-Type"], "text/html; charset=utf-8")

self.assertNotContains(response, 'id="status-sidebar-live"')

# Check the edit_alias.html template was used instead
self.assertTemplateUsed(response, "wagtailadmin/pages/edit_alias.html")
original_page_edit_url = reverse(
"wagtailadmin_pages:edit", args=[self.unpublished_page.id]
)
self.assertContains(
response,
f'<a class="button button-secondary" href="{original_page_edit_url}">Edit original page</a>',
html=True,
)

def test_post_edit_alias_page(self):
alias_page = self.child_page.create_alias(update_slug="new-child-page")

Expand Down