Skip to content
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

Fix notices errors with some locales #364

Merged
merged 4 commits into from
Mar 16, 2024
Merged

Conversation

enricobattocchi
Copy link
Member

@enricobattocchi enricobattocchi commented Mar 16, 2024

Context

Summary

This PR can be summarized in the following changelog entry:

  • Fixes a bug where notices would not be appearing in the block editor, throwing console errors, with some locales.

Relevant technical choices:

Test instructions

Test instructions for the acceptance test before the PR gets merged

This PR can be acceptance tested by following these steps:

Reproduce the problem

  • use the latest released version (or main)
  • switch WP to Italian, this ensures that the translated string has an ' which breaks the parsing
  • keep the console open
  • create a Rewrite & Republish copy of a published post
  • see that when you are redirected to the Editor you don't see any notice
  • see that you get a JS error in the console: Uncaught ReferenceError: duplicatePostNotices is not defined
  • edit the post
  • click on "Ripubblica" ("Republish"), also in the pre-publish confirmation sidebar
  • see that you are not redirected to the republished post but you stay in the same screen and you get a notification telling that the draft has been saved
  • navigate to the post list and see that the republishing actually happened anyway

Test the fix

  • switch to this branch
  • switch WP to Italian, this ensures that the translated string has an '
  • keep the console open
  • create a Rewrite & Republish copy of a published post
  • see that when you are redirected to the Editor you see a notice
    • Ora puoi iniziare a riscrivere il tuo articolo in questo duplicato dell'originale. Se fai clic su "Ripubblica", questo articolo riscritto sostituirà l'originale.
  • see that you don't get a JS error in the console
  • edit the original post
  • see that when you are redirected to the Editor you see a notice
    • È stato creato un duplicato di questo articolo. Tieni in considerazione che ogni modifica che fai a questo articolo sarà sostituita quando la versione duplicata sarà ripubblicata.
  • see that you don't get a JS error in the console
  • make a change in the original post and click "Aggiorna" ("Update")
  • edit the R&R copy
  • see that you see a notice
    • L'articolo originale è stato nel frattempo modificato. Se fai clic su "Ripubblica", questo articolo riscritto sostituirà l'originale.
  • see that you don't get a JS error in the console
  • change the date of the post to a future date and hit "Programma la ripubblicazione..." ("Schedule republishing")
  • edit the original post
  • see that when you are redirected to the Editor you see a notice
    • È stato creato un duplicato di questo articolo, che dovrebbe sostituire questo articolo in data Maggio 18, 2024 alle ore 3:59 pm.
  • see that you don't get a JS error in the console
  • edit the R&R copy
  • change the date of the post to "Ora" ("Now") or to a past date and hit "Ripubblica" ("Republish")
  • see that you are redirected to the edit screen
  • See that you see a notice
    • Il tuo articolo originale è stato sostituito con l'articolo riscritto. Stai ora visualizzando l'articolo originale (riscritto).
  • see that you don't get a JS error in the console

Relevant test scenarios

  • Changes should be tested with the browser console open
  • Changes should be tested on different posts/pages/taxonomies/custom post types/custom taxonomies
  • Changes should be tested on different editors (Default Block/Gutenberg/Classic/Elementor/other)
  • Changes should be tested on different browsers
  • Changes should be tested on multisite

Test instructions for QA when the code is in the RC

  • QA should use the same steps as above.

QA can test this PR by following these steps:

Impact check

This PR affects the following parts of the plugin, which may require extra testing:

UI changes

  • This PR changes the UI in the plugin. I have added the 'UI change' label to this PR.

Documentation

  • I have written documentation for this change. For example, comments in the Relevant technical choices, comments in the code, documentation on Confluence / shared Google Drive / Yoast developer portal, or other.

Quality assurance

  • I have tested this code to the best of my abilities
  • I have added unittests to verify the code works as intended

Innovation

  • No innovation project is applicable for this PR.
  • This PR falls under an innovation project. I have attached the innovation label and noted the work hours.

Fixes #

@enricobattocchi enricobattocchi merged commit 94b469c into trunk Mar 16, 2024
23 checks passed
@enricobattocchi enricobattocchi deleted the fix/parse-errors branch March 16, 2024 11:12
@enricobattocchi enricobattocchi added this to the 4.6 milestone Mar 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant