wagtail / wagtail-localize

Translation plugin for Wagtail CMS
https://wagtail-localize.org/
Other
228 stars 87 forks source link

Page alias first/last_published_at is null when publishing a draft #748

Open TheoChevalier opened 2 years ago

TheoChevalier commented 2 years ago

This is a follow up for wagtail/wagtail#7788, it fixed first/last_published_at when directly hitting publish while creating a new page.

I just noticed the issue still happens when you first save a draft then hit publish. This turns out to be the process commonly used by our editors.

tbrlpld commented 2 years ago

@TheoChevalier I am having a hard time piecing the reproduction steps together between all the different PRs and issues mentioned in the chain here. Could you add the exact steps you are taking to reproduce? Also, are you able to reproduce this in Wagtail Bakery?

TheoChevalier commented 2 years ago

Hey @tbrlpld,

I’ve never set up Wagtail bakery locally, but I have steps to reproduce on the MoFo website.

1) Open https://foundation.mofostaging.net/cms/pages/789/ (Blog index page) 2) Click "Add child page" 3) Add a title, author, paragraph 4) Hit "Save draft" 5) Hit "Publish"

Check an alias of the source page you just published, e.g. the French alias page https://foundation.mofostaging.net/fr/blog/test/ If the page mentions "not published yet", you’re reproducing the bug

Capture d’écran 2022-03-29 à 18 41 32

If you remove step 4, the bug doesn’t happen (that’s the use case fixed in #https://github.com/wagtail/wagtail/pull/7788)

mtdenton commented 12 months ago

@gasman any movement here on this? We're auditing our backlog and this came up (for reference, https://github.com/MozillaFoundation/foundation.mozilla.org/issues/8470)

gasman commented 12 months ago

I'm going to bump this issue over to wagtail-localize, as it sounds like we need more context from there before we can identify an action to take. As things stand, all we really know from the Wagtail side is that wagtail-localize (or at least Mozilla's implementation of it) is doing something with after_create_page / after_publish_page that's producing incorrect results because wagtail-localize is making assumptions that don't match the reality, but not any of the specifics.

zerolab commented 12 months ago

@gasman localize uses page.copy_for_translation() - https://github.com/wagtail/wagtail-localize/blob/main/wagtail_localize/synctree.py#L216-L217 on after_create_page