Skip to content

Commit f7576d2

Browse files
stevejalimCopilot
andauthored
Cms homepage shuffle papercuts (#17163)
* fix: allow new HomePage to be the parent of any other kind of page * fix: pass fallback_ftl_files to prefer_cms for HomePage and AboutPage, remove duplicate home route from urls.py * feat: improve copilot auto-review instructions to catch a gap in prefer_cms usage * fix: make speccing fallback files for prefer_cms more robust Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> * fix: avoid copilot meta instructions that seem to trip it up - make clear which copilot rules are canonical --------- Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
1 parent 34de242 commit f7576d2

4 files changed

Lines changed: 6 additions & 7 deletions

File tree

.github/copilot-instructions.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@ Fetch the latest version of all the checklists mentioned on https://mozmeao.gith
66

77
Read AGENTS.md for supplementary instructions.
88

9-
If a mirrored copy of these instructions exists at `custom-instructions/repo/.github/copilot-instructions.md`, keep it fully synchronized with this file and any referenced AGENTS.md guidance, including section renumbering and DB schema guidance, or remove it to avoid drift and inconsistent Copilot behavior.
9+
If a mirrored copy of these instructions exists at `custom-instructions/repo/.github/copilot-instructions.md`, keep it fully synchronized with this file and any referenced AGENTS.md guidance, including section renumbering and DB schema guidance, or remove it to avoid drift and inconsistent Copilot behavior. If the mirrored version is out of sync, use this version as the canonical source and overwrite the mirrored version.
10+
1011
Try to use Conventional Comments to indicate the kind of feedback you are providing, and whether it's blocking or non-blocking.
1112

1213
Also, confirm in a comment on the PR that you are using this custom instructions file, please.
@@ -59,6 +60,8 @@ Be particularly aware of CMS-backed content that is not richtext. Ensure it's es
5960

6061
* If a new Snippet (a Django model decorated with @register_snippet) is added, add a reminder in a comment to ensure that the Editors have permission to see and edit the new Snippet. That permission is added manually via the Wagtail UI.
6162

63+
* If a Django view is being decorated for the first time with the `prefer_cms()` decorator and there is no `fallback_ftl_files=` parameter being passed in to `prefer_cms()`, add a non-blocking comment questioning whether it should be present, because without it, the page will only show the locales available in the CMS in the footer links on the page
64+
6265
## 8. Database schema changes
6366

6467
* We use Django migrations to manage database schema state and also sometimes to adjust data. Django migrations are the ONLY permissible way to change database schema.

bedrock/mozorg/models.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -440,7 +440,6 @@ class HomePage(AbstractBedrockCMSPage):
440440
"""CMS-managed homepage for mozilla.org."""
441441

442442
max_count = 1 # Ensure there's only one instance of this page
443-
subpage_types = [] # This page type cannot have any children
444443
ftl_files = ["mozorg/home-m24"]
445444

446445
content = StreamField(

bedrock/mozorg/urls.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@
2121
from .util import page
2222

2323
urlpatterns = [
24-
path("", prefer_cms(views.HomeView.as_view()), name="mozorg.home"),
25-
path("about/", prefer_cms(views.AboutView.as_view()), name="mozorg.about.index"),
24+
path("", prefer_cms(views.HomeView.as_view(), fallback_ftl_files=views.HomeView.activation_files), name="mozorg.home"),
25+
path("about/", prefer_cms(views.AboutView.as_view(), fallback_ftl_files=views.AboutView.activation_files), name="mozorg.about.index"),
2626
page("about/manifesto/", "mozorg/about/manifesto.html", ftl_files=["mozorg/about/manifesto"]),
2727
page("about/manifesto/details/", "mozorg/about/manifesto-details.html", ftl_files=["mozorg/about/manifesto"]),
2828
page("account/", "mozorg/account.html", ftl_files=["firefox/accounts"]),

bedrock/urls.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,6 @@
1515
from bedrock.base import views as base_views
1616
from bedrock.base.i18n import bedrock_i18n_patterns
1717
from bedrock.cms import wagtail_urls
18-
from bedrock.cms.decorators import prefer_cms
19-
from bedrock.mozorg import views as mozorg_views
2018

2119
# The default django 404 and 500 handler doesn't run the ContextProcessors,
2220
# which breaks the base template page. So we replace them with views that do!
@@ -28,7 +26,6 @@
2826
# Paths that should have a locale prefix
2927
urlpatterns = bedrock_i18n_patterns(
3028
# Main pages
31-
path("", prefer_cms(mozorg_views.HomeView.as_view()), name="mozorg.home"),
3229
path("foundation/", include("bedrock.foundation.urls")),
3330
path("about/legal/", include("bedrock.legal.urls")),
3431
path("press/", include("bedrock.press.urls")),

0 commit comments

Comments
 (0)