Skip to content

Conversation

@BogdanUngureanu
Copy link
Contributor

@BogdanUngureanu BogdanUngureanu commented May 20, 2021

Disables editing and deleting capabilities in WP-Admin Post list for the page that is configured as a Posts Page in WP-Admin.

Fixes Automattic/wp-calypso#52692

Changes proposed in this Pull Request:

  • Removed the edit_post and delete_post capabilities for all users for the page is configured as a Posts page in WP-Admin.
  • Added an info icon for informing the user why the page cannot be edited or deleted.

Does this pull request change what data or activity we track or use?

No

Testing instructions:

Atomic:

  • Install Jetpack Beta plugin and switch to the current branch.
  • Make sure that you have a Posts Page configured for your site (Configurable in Settings > Reading section).
  • Go to WP-Admin > Pages section
  • Make sure that the page configured in the second step cannot be edited and deleted
  • Make sure that the page has an info icon with a title informing why the page cannot be edited or deleted.

Simple Sites

  • Apply the following patch on your sandbox: D61647-code
  • Copy projects/plugins/jetpack/modules/masterbar/wp-posts-list/class-posts-list-page-notification.php class into the corresponding WPCOM directory.
  • Make sure that you have the Show wp-admin pages if available toggle on in wordpress.com/me/account section
  • Go to your-site.wordpress.com/wp-admin/
  • Make sure that you have a Posts Page configured for your site (Configurable in Settings > Reading section)
  • Go to WP-Admin > Pages section
  • Make sure that the page configured in the third step cannot be edited and deleted
  • Make sure that the page has a info icon with a title informing why the page cannot be edited or deleted

Note: Since the implementation was added within a new directory (wp-posts-list) that it's not currently managed by Jetpack Fusion, the following diff also have to be reviewed: D61647-code.

@matticbot
Copy link
Contributor

Caution: This PR has changes that must be merged to WordPress.com
Hello BogdanUngureanu! These changes need to be synced to WordPress.com - If you 're an a11n, please commandeer and confirm D61647-code works as expected before merging this PR. Once this PR is merged, please commit the changes to WP.com. Thank you!
This revision will be updated with each commit to this PR

@github-actions github-actions bot added [Plugin] Jetpack Issues about the Jetpack plugin. https://wordpress.org/plugins/jetpack/ [Feature] Masterbar WordPress.com Toolbar and Dashboard customizations Unit Tests labels May 20, 2021
@github-actions
Copy link
Contributor

github-actions bot commented May 20, 2021

Thank you for your PR!

When contributing to Jetpack, we have a few suggestions that can help us test and review your patch:

  • ✅ Include a description of your PR changes.
  • ⚠️ All commits were linted before commit.
  • ✅ Add a "[Status]" label (In Progress, Needs Team Review, ...).
  • ✅ Add testing instructions.
  • ✅ Specify whether this PR includes any changes to data or privacy.
  • ✅ Add changelog entries to affected projects

This comment will be updated as you work on your PR and make changes. If you think that some of those checks are not needed for your PR, please explain why you think so. Thanks for cooperation 🤖


Once your PR is ready for review, check one last time that all required checks (other than "Required review") appearing at the bottom of this PR are passing or skipped.
Then, add the "[Status] Needs Team review" label and ask someone from your team review the code.
Once you’ve done so, switch to the "[Status] Needs Review" label; someone from Jetpack Crew will then review this PR and merge it to be included in the next Jetpack release.


Jetpack plugin:

  • Next scheduled release: June 1, 2021.
  • Scheduled code freeze: May 24, 2021.

@github-actions github-actions bot added the [Status] Needs Author Reply We need more details from you. This label will be auto-added until the PR meets all requirements. label May 20, 2021
@BogdanUngureanu BogdanUngureanu changed the title Disabled editing and deleting capabilities in WP-Admin Post list Disabled editing and deleting capabilities in WP-Admin Post list for Posts Page May 20, 2021
@BogdanUngureanu BogdanUngureanu added [Status] Needs Team Review Obsolete. Use Needs Review instead. and removed [Status] Needs Author Reply We need more details from you. This label will be auto-added until the PR meets all requirements. labels May 20, 2021
@tjcafferkey
Copy link
Contributor

Make sure that the page has an info icon with a title informing why the page cannot be edited or deleted.

Is hovering over this supposed to reveal a tooltip with the title value? If so I'm unable to replicate this on both Atomic or Simple site.

@BogdanUngureanu
Copy link
Contributor Author

Is hovering over this supposed to reveal a tooltip with the title value? If so I'm unable to replicate this on both Atomic or Simple site.

Yes, hovering over the icon should display a message about why the page cannot be edited. It's not actually a tooltip, it uses the built in HTML title attribute. Not ideal, but I couldn't find a library from WPCore to use instead.

@cpapazoglou cpapazoglou self-requested a review May 20, 2021 14:02
Copy link
Contributor

@cpapazoglou cpapazoglou left a comment

Choose a reason for hiding this comment

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

Excellent work @BogdanUngureanu ! The code changes test well for me both in Simple & Atomic sites 🎉!

I have left some comments for discussion.

@BogdanUngureanu BogdanUngureanu force-pushed the add/disable-edit-and-delete-on-posts-page branch from 8b19a50 to b7d9301 Compare May 21, 2021 12:54
@BogdanUngureanu BogdanUngureanu force-pushed the add/disable-edit-and-delete-on-posts-page branch from b7d9301 to 3e7088c Compare May 21, 2021 13:00
Copy link
Member

@mmtr mmtr left a comment

Choose a reason for hiding this comment

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

This works great on my tests. Just left a comment regarding smaller viewports.

@BogdanUngureanu BogdanUngureanu force-pushed the add/disable-edit-and-delete-on-posts-page branch from 040a537 to a909d52 Compare May 21, 2021 14:43
@BogdanUngureanu BogdanUngureanu force-pushed the add/disable-edit-and-delete-on-posts-page branch from 78adcc3 to 3c27284 Compare May 21, 2021 15:36
Copy link
Member

@mmtr mmtr left a comment

Choose a reason for hiding this comment

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

Tested a variety of scenarios in both Simple and Atomic sites, and everything worked as espected. Nice job, @BogdanUngureanu!

@mmtr mmtr dismissed cpapazoglou’s stale review May 21, 2021 16:02

Feedback has been addressed

@mmtr mmtr added [Status] Ready to Merge Go ahead, you can push that green button! and removed [Status] Needs Team Review Obsolete. Use Needs Review instead. labels May 21, 2021
@mmtr mmtr added this to the jetpack/9.8 milestone May 21, 2021
@samiff samiff merged commit d6a3522 into master May 21, 2021
@samiff samiff deleted the add/disable-edit-and-delete-on-posts-page branch May 21, 2021 21:55
@github-actions github-actions bot removed the [Status] Ready to Merge Go ahead, you can push that green button! label May 21, 2021
@github-actions
Copy link
Contributor

Great news! One last step: head over to your WordPress.com diff, D61647-code, and commit it.
Once you've done so, come back to this PR and add a comment with your changeset ID.

Thank you!

@BogdanUngureanu
Copy link
Contributor Author

Deployed on r226120-wpcom

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

[Feature] Masterbar WordPress.com Toolbar and Dashboard customizations [Plugin] Jetpack Issues about the Jetpack plugin. https://wordpress.org/plugins/jetpack/ Touches WP.com Files Unit Tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Blog Posts Page can be edited when it should not (on AT sites and Simple sites with Show wp-admin pages if available turned on)

8 participants