-
-
Notifications
You must be signed in to change notification settings - Fork 30
Remove Webmention Dependence on Pings #485
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
Merged
Merged
Changes from all commits
Commits
Show all changes
27 commits
Select commit
Hold shift + click to select a range
2e295de
Remove dependence on pings_open for whether a webmention was open.
dshanske 525549c
Switch from using the ping list in the post to a separate list that o…
dshanske cff074e
Remove ping usage from sender
dshanske 1b24c81
Merge branch 'main' into webmentionopen
pfefferle c3da954
Restore update punged
dshanske 25bbcee
Merge branch 'main' into webmentionopen
dshanske 3da5d65
Merge branch 'main' into webmentionopen
pfefferle ab67e07
Merge branch 'main' into webmentionopen
pfefferle 0681b06
Simplify webmentions_open and add better comment
dshanske f140c1a
remove the "webmentions_closed" meta value if the post is updated
pfefferle 9d5522c
add block-editor settings to disable webmentions
pfefferle 18c89ce
Merge branch 'main' into webmentionopen
pfefferle d743ab0
fix phpcs
pfefferle e08d739
check if site supports blocks before loading them
pfefferle e0d7cfd
Merge branch 'main' into webmentionopen
dshanske 8b11396
re-add block-editor dependencies
pfefferle 3b26a5e
Merge branch 'main' into webmentionopen
pfefferle ed657c6
small change
pfefferle 43ecf97
phpunit
pfefferle 21a469c
Merge branch 'main' into webmentionopen
pfefferle b46e514
fix test
pfefferle 9f2106e
fix tests
pfefferle b0d1085
change name
pfefferle a888261
use simpler name
pfefferle ef3e59e
update name
pfefferle 84abba8
clear _mentionme after sending the mentions
pfefferle 858506d
revert
pfefferle File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,6 +4,7 @@ | |
/node_modules | ||
/bin | ||
/sass | ||
/src | ||
/vendor | ||
/tests | ||
/config | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,7 +11,3 @@ charset = utf-8 | |
[*.php] | ||
indent_style = tab | ||
indent_size = 4 | ||
|
||
[*.{js,json}] | ||
indent_style = space | ||
indent_size = 2 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
{ | ||
"name": "editor-plugin", | ||
"title": "Editor Plugin: not a block, but block.json is very useful.", | ||
"category": "widgets", | ||
"icon": "admin-comments", | ||
"keywords": [], | ||
"editorScript": "file:./plugin.js" | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
<?php return array('dependencies' => array('react', 'wp-components', 'wp-core-data', 'wp-data', 'wp-editor', 'wp-i18n', 'wp-plugins'), 'version' => '03845d869ccb1b1eb23c'); |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
<?php | ||
|
||
namespace Webmention; | ||
|
||
class Block { | ||
/** | ||
* Initialize the class, registering WordPress hooks. | ||
*/ | ||
public static function init() { | ||
// Add editor plugin. | ||
\add_action( 'enqueue_block_editor_assets', array( self::class, 'enqueue_editor_assets' ) ); | ||
\add_action( 'init', array( self::class, 'register_postmeta' ), 11 ); | ||
} | ||
|
||
/** | ||
* Register post meta | ||
*/ | ||
public static function register_postmeta() { | ||
$post_types = \get_post_types_by_support( 'webmentions' ); | ||
foreach ( $post_types as $post_type ) { | ||
\register_post_meta( | ||
$post_type, | ||
'webmentions_disabled', | ||
array( | ||
'show_in_rest' => true, | ||
'single' => true, | ||
'type' => 'boolean', | ||
) | ||
); | ||
} | ||
} | ||
|
||
/** | ||
* Enqueue the block editor assets. | ||
*/ | ||
public static function enqueue_editor_assets() { | ||
// Check for our supported post types. | ||
$current_screen = \get_current_screen(); | ||
$ap_post_types = \get_post_types_by_support( 'webmentions' ); | ||
if ( ! $current_screen || ! in_array( $current_screen->post_type, $ap_post_types, true ) ) { | ||
return; | ||
} | ||
$asset_data = include WEBMENTION_PLUGIN_DIR . 'build/editor-plugin/plugin.asset.php'; | ||
$plugin_url = plugins_url( 'build/editor-plugin/plugin.js', WEBMENTION_PLUGIN_FILE ); | ||
wp_enqueue_script( 'webmention-block-editor', $plugin_url, $asset_data['dependencies'], $asset_data['version'], true ); | ||
} | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
{ | ||
"name": "editor-plugin", | ||
"title": "Editor Plugin: not a block, but block.json is very useful.", | ||
"category": "widgets", | ||
"icon": "admin-comments", | ||
"keywords": [], | ||
"editorScript": "file:./plugin.js" | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
import { PluginDocumentSettingPanel } from '@wordpress/editor'; | ||
import { registerPlugin } from '@wordpress/plugins'; | ||
import { CheckboxControl } from '@wordpress/components'; | ||
import { useSelect } from '@wordpress/data'; | ||
import { useEntityProp } from '@wordpress/core-data'; | ||
import { __ } from '@wordpress/i18n'; | ||
|
||
|
||
const EditorPlugin = () => { | ||
const postType = useSelect( | ||
( select ) => select( 'core/editor' ).getCurrentPostType(), | ||
[] | ||
); | ||
const [ meta, setMeta ] = useEntityProp( 'postType', postType, 'meta' ); | ||
|
||
return ( | ||
<PluginDocumentSettingPanel | ||
name="webmention" | ||
title={ __( 'Webmentions', 'webmention' ) } | ||
> | ||
<CheckboxControl | ||
__nextHasNoMarginBottom | ||
label={ __( 'Disable Webmentions', 'webmention' ) } | ||
help={ __( 'Do not accept incoming Webmentions for this post.', 'webmention' ) } | ||
checked={ meta.webmentions_disabled } | ||
onChange={ ( value ) => { | ||
setMeta( { ...meta, webmentions_disabled: value } ); | ||
} } | ||
/> | ||
</PluginDocumentSettingPanel> | ||
); | ||
} | ||
|
||
registerPlugin( 'webmention-editor-plugin', { render: EditorPlugin } ); |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.