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

Gutenberg: Check for Publicize capabilities at registration #10912

Merged
merged 1 commit into from
Dec 11, 2018

Conversation

tyxla
Copy link
Member

@tyxla tyxla commented Dec 10, 2018

Currently, we're registering the Publicize extension for Gutenberg, regardless of whether the current user has enough permissions to work with it. Instead, we should register as available only when the current user has the necessary capability. See #10910 for more details.

Fixes #10910.

Changes proposed in this Pull Request:

  • Check for the needed capabilities when registering the Publicize extension, and conditionally register it as available based on the presence/absence of these capabilities.

Testing instructions:

  • Spin up a JN site with this branch - use this link.
  • Connect the site, and activate the recommended features.
  • Start writing a post.
  • Click the Publish button.
  • Verify you can see the Publicize UI, the Jetpack icon in the toolbar, and the Jetpack sidebar when you click that icon.
  • Create a user with the Contributor role.
  • Login as that new user.
  • Start writing a new post.
  • Verify you can't see the Publicize UI anywhere.

Proposed changelog entry for your changes:

  • Now properly conditionally displaying the Gutenberg Publicize UI based on the permissions of the current user.

@tyxla tyxla added [Type] Bug When a feature is broken and / or not performing as intended [Feature] Publicize Now Jetpack Social, auto-sharing [Status] Needs Review To request a review from fellow Jetpack developers. Label will be renamed soon. [Pri] Normal [Focus] Blocks Issues related to the block editor, aka Gutenberg, and its extensions developed in Jetpack labels Dec 10, 2018
@tyxla tyxla self-assigned this Dec 10, 2018
@tyxla tyxla requested review from a team December 10, 2018 14:39
@tyxla tyxla requested a review from a team December 10, 2018 14:39
@matticbot
Copy link
Contributor

D22066-code. (newly created revision)

@jetpackbot
Copy link

Thank you for the great PR description!

When this PR is ready for review, please apply the [Status] Needs Review label. If you are an a11n, please have someone from your team review the code if possible. The Jetpack team will also review this PR and merge it to be included in the next Jetpack release.

Scheduled Jetpack release: January 10, 2019.
Scheduled code freeze: January 3, 2019

Generated by 🚫 dangerJS against `23f517a8c87b95d66ae53c39a19a632f5551f242`

@arunsathiya
Copy link

I tested this, and I can confirm that the changes work as expected.

Admin role - primary user

For the primary user role, admin role, I was able to see the Publicize UI when I first clicked Publish and so was the case on using the Jetpack icon on the WordPress Editor toolbar. The Jetpack sidebar opens up fine and shows the Publicize UI.

screenshot 2018-12-10 at 20 57 57

screenshot 2018-12-10 at 20 57 51

Contributor role

For the contributor profile, I was not able to see Publicize UI on clicking Publish and I was not able to see the Jetpack icon either.

screenshot 2018-12-10 at 21 00 37

screenshot 2018-12-10 at 21 00 32

Connection flow unchanged

As a side note, I also attempted to connect a test Twitter profile, and it works as expected. No changes there.

Copy link
Member

@roccotripaldi roccotripaldi left a comment

Choose a reason for hiding this comment

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

I haven't tested - but this seems like a solid approach!

@gititon gititon self-requested a review December 10, 2018 20:46
Copy link
Contributor

@gititon gititon left a comment

Choose a reason for hiding this comment

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

Tested, works well.

@tyxla tyxla added this to the 6.9 milestone Dec 11, 2018
Copy link
Contributor

@brbrr brbrr left a comment

Choose a reason for hiding this comment

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

Changes looks good! Tests well. 🚢

@brbrr brbrr added [Status] Ready to Merge Go ahead, you can push that green button! and removed [Status] Needs Review To request a review from fellow Jetpack developers. Label will be renamed soon. labels Dec 11, 2018
@brbrr brbrr merged commit f4429b0 into master Dec 11, 2018
@brbrr brbrr deleted the fix/gutenberg-publicize-registration-capabilities branch December 11, 2018 15:08
jeherve added a commit that referenced this pull request Dec 19, 2018
jeherve added a commit that referenced this pull request Jan 3, 2019
jeherve added a commit that referenced this pull request Jan 3, 2019
* Add first version of the Changelog and testing list for 6.9

* Changelog: add #10710

* changelog: add #10538

* changelog: add #10741

* changelog: add #10749

* changelog: add #10664

* changelog: add #10224

* changelog: add #10788

* Changelog: add #10560

* Chanegelog: add #10812

* changelog: add #10556

* Changelog: add #10668

* Changelog: add #10846

* Changelog: add #10947

* Changelog: add #10962

* Changelog: add #10956

* Changelog: add #10940

* Changelog: add #10934

* Changelog: add #10912

* changelog: add #10866

* changelog: add #10924

* Changelog: add #10936

* Changelog: add #10833

* changelog: add #10867

* Changelog: add #10960

* Changelog: add #10888

* changelog: add #10840

* changelog: add #10972

* Changelog: add #10979

* changelog: add #10909

* Changelog: add #10958

* Changelog: add #10981

* Changelog: add #10564

* Changelog: add #10809

* Changelog: add #10982

* Changelog: add #10706

* Changelog: add #10978

* Changelog: add #10132

* Changelog: add #11022

* Changelog: add #11024

* Changelog: add #10875

* Changelog: add #11030

* Changelog: add #11053

* Changelog: add #10880

* Changelog: add #9359

* Changelog: add #11037

* Update block list

* Changelog: add #11060

* Changelog: add #10755

* changelog: add #11000

* Changelog: add #10786

* Changelog: add #10945

* Changelog: add #10597
@kraftbj kraftbj removed the [Status] Ready to Merge Go ahead, you can push that green button! label Oct 13, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Feature] Publicize Now Jetpack Social, auto-sharing [Focus] Blocks Issues related to the block editor, aka Gutenberg, and its extensions developed in Jetpack [Pri] Normal Touches WP.com Files [Type] Bug When a feature is broken and / or not performing as intended
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Gutenberg: Publicize: Hide or Disable Settings for Contributor
9 participants