-
Notifications
You must be signed in to change notification settings - Fork 921
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
Migrate VPN resource center to Wagtail (#14860) #15236
Conversation
a2ab0e7
to
a346dc5
Compare
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #15236 +/- ##
==========================================
+ Coverage 78.40% 78.55% +0.15%
==========================================
Files 157 158 +1
Lines 8195 8257 +62
==========================================
+ Hits 6425 6486 +61
- Misses 1770 1771 +1 ☔ View full report in Codecov by Sentry. |
name="products.vpn.resource-center.landing", | ||
), | ||
path( | ||
"vpn/resource-center/<slug:slug>/", | ||
views.resource_center_article_view, | ||
prefer_cms(views.resource_center_article_view), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note that prefer_cms
might not be working quite right here, since I no longer see the list of existing Fluent translations in the language selector once published, and all locales then redirect to wagtail published en-US
page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah i think prefer_cms
needs to be able to be locale-aware, and I suspect it's not right now. Will take a look as part of reviewing this PR
Yeah, I agree - no need to add stuff we're not using (yet?) |
If we can get the |
This sounds like a good plan to me 👍 |
From the instructions
We shouldn't need to make any migrations, just run the ones in the branch. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Commenting now for discussion of the Snippet stuff before I test drive, but looking really good IMO.
I'll try out fixing up the prefer_cms decorator now and see how I go, but wanted to bounce the comments your way in the meantime
bedrock/mozorg/migrations/0004_alter_leadershippage_leadership_sections.py
Show resolved
Hide resolved
bedrock/products/templates/products/vpn/cms/resource-center/base.html
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Notes from test driving
-
We should consider falling back to page.title if page.seo_title is not available for the
<title>
element -
Child page selection needs filtering to be the same locale as the index page - change suggested in a comment
-
I can create a new CTA Snippet when none exists, but I can't create addtional ones directly in the Snippets section of the Wagtail Admin - that's odd. Is there an extra permission we need to add somewhere? (I can help with this, but just writing it down now)
I see this behavior too. Maybe it's intended, since those snippets need to be associated with a page model when they are created? |
a346dc5
to
a69305c
Compare
@stevejalim thanks for the review so far. Pushed a commit with some fixes |
a69305c
to
eda9931
Compare
The problem is that the current workflow only then allows the creation of one snippet ever - once one exists in the system, the user is prompted to use that, rather than make another. Plus it should be possible to change the snippet associated with a part of page if we want to |
Hmm, I don't see this behavior - I'm pretty sure I created two snippets? Edit: no you're correct - something has changed as now I can only create one as well :/ |
@stevejalim one other thing I think we might still need to take care of here, is when publishing a page in the CMS, it seems to override |
3b57198
to
a570e9b
Compare
So yeah, this is how things used to work with the Contentful-powered version - and, indeed, across all Wagtail-powered pages now -- we work out what locales a page is available in based on the actual translations in the CMS - see here I'm about to test whether the bedrock/bedrock/products/views.py Lines 225 to 228 in 029f88e
bedrock/bedrock/contentful/utils.py Line 13 in 029f88e
bedrock/bedrock/settings/base.py Lines 1077 to 1081 in 029f88e
It might be that dropping that threshold will reinstate the lang picker, but that's a tangent to the CMS work. So right now, given this, plus the fact we have the localized content available and we'll be able to get it into Smartling relatively quickly, I think it might not be a problem. What do you think? |
Put another way, the other locales are currently also unreachable via the lang picker from the index page. (Though the lang picker does work on an individual page, which would break when we add en-US, you're 100% right on that) |
My testing seems to indicate that all previous translations are disabled, and redirected to en-US. So it's not just an issue with the language selector.
I think we should prioritize getting this into Wagtail as opposed to fixing existing issues in the contentful content, yeah. |
Feeding back from local testing so far:
|
Ah, yes, I can reproduce that. I will see if a tweak to
Agreed |
41ef99a
to
883d55a
Compare
…02 to en-US ...due to the l10n_utils.render() being unable to find the right list of available locales for the fallback/Django version of the page
f706110
to
6b9193a
Compare
FYI I've just tested submitting the VPN RC index page (featuring two separate Snippets) to Smartling and it worked, making one job for the main page and one job for each of the Snippets 👍 |
…adding to the page tree This avoid the behaviour where /fr/test-page/ has the content of /en-US/test-page because the former was auto-published when spawned from the latter
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
After more test driving and tweaking of the l10n side, this is a good-for-now r+ from me.
The core Wagtail work is solid - the issues that have cropped up are all related to l10n and the workflows around it, which are grouped in #15348
As long as we're happy with the updated/fixed behaviour of the prefer_cms
decorator we can definitely merge this now.
If we use it for the en-US version of the VPN RC, the only downside will be that non-en-US
loacles will not be reachable from the en-US
version because the locale picker either only looks at CMS pages or only looks at Django pages, but neither looks at the other.
One-line summary
Migrates VPN Resource Center index and detail pages to Wagtail.
Significant changes and points to review
One thing we might have to think about is how we plan to roll these pages out once this merges. This will be the first time we're testing localization through Smartling, and we need to be careful not to temporarily "lose" any content in the process.
Also, there were a few things in the old Contentful pages that had code but were never implemented (such as related article categories). I'm not going to port those over now, seeing as they never made it to production?
Issue / Bugzilla link
#14860
Testing
make preflight
./manage.py makemigrations
and then./manage.py migrate
npm start
.Mozilla Products
with a slugproducts
.Mozilla VPN
with a slugvpn
, and hit publish./vpn/
structural page and add a child page of typeVpn resource center index page
. Make sure it has a slug ofresource-center
.Vpn resource center detail page
(this should be the only child type that's allowed by the parent).Call to action bottom
snippet, it should only show up when you have more than 6 child articles.Review TODOs for @stevejalim
prefer_cms
falls back to CMS-based en-US page even though other locales exist for that path outside the CMS