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

P3-321 improve Metabox class #116

Merged
merged 3 commits into from
Mar 18, 2021
Merged

P3-321 improve Metabox class #116

merged 3 commits into from
Mar 18, 2021

Conversation

enricobattocchi
Copy link
Member

@enricobattocchi enricobattocchi commented Mar 15, 2021

Context

  • The current implementation of the Metabox class has been copied directly from the legacy code. It uses WP function and hooks in a wrong way and forces to use JS to hide the custom metabox for post that are not copies.

Summary

This PR can be summarized in the following changelog entry:

  • Refactors the Metabox class.

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:

  • visit Settings > Duplicate Post, third tab Display, and make sure the Show original item: > In a metabox in the Edit screen option is enabled.
  • Make sure you have at least:
    • 1 post which is not a copy of anything
    • 1 post which is a R&R copy of another post
    • 2 posts which are regular copy of other posts
    • 1 page which is a regular copy of another page
  • perform the following steps both in Block and Classic editor
  • Edit a post which is not a copy of anything, and see that you don't see any Duplicate Post metabox. Please make sure the metabox is not disabled (Block editor: Options > Preferences > Panels, Classic editor: Screen options). Note by Andrea: just to clarify these test instructions for future reference: in this case, there's no setting related to the Duplicate Post meta box under "Block editor: Options > Preferences > Panels, Classic editor: Screen options" and that's the expected behavior. The setting is only displayed for posts that do have a copy.
  • Edit a post which is a R&R copy of a post, and see that you see a Duplicate Post metabox like this one (Classic editor view, in Block Editor the content will be the same)
    Screenshot_2021-03-15 Edit Post ‹ Basic — WordPress(1)
  • Edit a post which is a regular copy of a post, and see that you see a Duplicate Post metabox like this one (Classic editor view, in Block Editor the content will be the same):
    Screenshot_2021-03-15 Edit Post ‹ Basic — WordPress
  • tick the checkbox and save the post
    • if you are on Block Editor, reload the page (F5) - on Classic Editor this happens automatically
    • see that the Metabox is not there anymore
  • visit Settings > Duplicate Post, second tab Permissions, and disable the plugin for the Page type
  • edit a page which is a copy of another page and see that you can't see the metabox at all
  • visit Settings > Duplicate Post, third tab Display, and make sure the Show original item: > In a metabox in the Edit screen option is disabled.
  • edit a post which is a copy of another page and see that you can't see the metabox at all

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.

Quality assurance

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

Fixes [P3-321]

@enricobattocchi enricobattocchi marked this pull request as ready for review March 15, 2021 17:30
@enricobattocchi
Copy link
Member Author

enricobattocchi commented Mar 15, 2021

Note to whoever will be accepting this: do not merge until the creation of release/4.1.2

Copy link
Contributor

@jcomack jcomack left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CR done 👍

@afercia
Copy link
Contributor

afercia commented Mar 18, 2021

Acceptance 👍

@afercia afercia added this to the 4.2 milestone Mar 18, 2021
@afercia afercia merged commit df5c7b9 into develop Mar 18, 2021
@afercia afercia deleted the P3-321-improve-metabox-class branch March 18, 2021 10:34
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.

3 participants