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

SDK: Add Jetpack publicize extension #26389

Merged
merged 4 commits into from
Jul 31, 2018
Merged

Conversation

tyxla
Copy link
Member

@tyxla tyxla commented Jul 30, 2018

This PR adds the Jetpack Publicize extension to the set of Gutenberg extensions, based on the previous work done by @c-shultz in: Automattic/jetpack#9934.

The code hasn't been edited yet - the idea is to be able to build it in Calypso and use it directly in Jetpack as a Gutenberg plugin. The only critical fix was the import of PluginPrePublishPanel, which is now in the public edit-post API (see WordPress/gutenberg#6798).

To test:

  • Build the extension:
    npm run sdk:gutenberg -- --editor-script=client/gutenberg/extensions/publicize/publicize-gutenberg-plugin.jsx
    
  • Copy the built file from: client/gutenberg/extensions/publicize/build/publicize-editor.js to Jetpack's folder - modules/publicize/assets/block.js (don't mind the file name we're using for now)
  • Checkout try/publicize-gutenberg-block-externally-built branch in your Jetpack installation (see Demo: Try externally built Publicize extension for Gutenberg jetpack#9963).
  • Make sure your user is connected to WP.com and is connected to at least one social network account.
  • Start a new Gutenberg post, attempt to publish it.
  • See the Publicize UI in the pre-publish panel; make sure it doesn't fatal Gutenberg, but ignore any cosmetic issues for now.

Fixes #26362.

@tyxla tyxla added [Status] Needs Review The PR is ready for review. This also triggers e2e canary tests and wp-desktop tests automatically. [Project] SDK labels Jul 30, 2018
@tyxla tyxla self-assigned this Jul 30, 2018
@matticbot
Copy link
Contributor

const {
withSelect,
withDispatch,
} = window.wp.data;
Copy link
Member

Choose a reason for hiding this comment

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

this shouldn't reference window here - = wp.data or better @wordpress/data

Copy link
Member Author

Choose a reason for hiding this comment

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

Fixed in bc312fd

window.clearInterval( popupTimer );
refreshCallback();
}
}, 500 );
Copy link
Member

Choose a reason for hiding this comment

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

it would be favorable not to use the setInterval() here - I'm curious why it's here. in general I think it's nice to rely on active propagation of the event rather than passive as is done here. that is, we should make a decision to check again in the future instead of relying on the system to automatically keep it going (that way we can prevent accidental background tasks from forming)

also, why was 500 chosen as the timeout value? (I'm starting to wonder if this was copy/pasted from Stack-Overflow without citation). There's a very similar solution there that uses 1000

@dmsnell
Copy link
Member

dmsnell commented Jul 30, 2018

@tyxla I think it's fine to merge this code here from where it came from and recognize that it needs work. we can iterate further from here.

@tyxla
Copy link
Member Author

tyxla commented Jul 30, 2018

recognize that it needs work. we can iterate further from here.

Yeah, totally - this applies for the rest of the blocks we already merged, too 😉

@tyxla tyxla force-pushed the sdk/add-jetpack-publicize-block branch from bc312fd to 94ba41a Compare July 31, 2018 10:43
@tyxla tyxla merged commit 93f9037 into master Jul 31, 2018
@tyxla tyxla deleted the sdk/add-jetpack-publicize-block branch July 31, 2018 11:15
@matticbot matticbot removed the [Status] Needs Review The PR is ready for review. This also triggers e2e canary tests and wp-desktop tests automatically. label Jul 31, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

SDK: move publicize block to Calypso
3 participants