Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion build/editor-plugin/plugin.asset.php
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<?php return array('dependencies' => array('react', 'wp-components', 'wp-core-data', 'wp-data', 'wp-editor', 'wp-i18n', 'wp-plugins'), 'version' => '03845d869ccb1b1eb23c');
<?php return array('dependencies' => array('react', 'wp-components', 'wp-core-data', 'wp-data', 'wp-editor', 'wp-i18n', 'wp-plugins'), 'version' => '5b3078e57362374cb01e');
2 changes: 1 addition & 1 deletion build/editor-plugin/plugin.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 9 additions & 0 deletions includes/class-block.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,15 @@ public static function register_postmeta() {
'type' => 'boolean',
)
);
\register_post_meta(
$post_type,
'webmentions_send_disabled',
array(
'show_in_rest' => true,
'single' => true,
'type' => 'boolean',
)
);
}
}

Expand Down
4 changes: 3 additions & 1 deletion includes/class-webmention.php
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,9 @@ public function enqueue_scripts() {
* @param mixed $meta_value The meta value.
*/
public function maybe_bypass_webmentions_disabled( $check, $object_id, $meta_key, $meta_value ) {
if ( 'webmentions_disabled' === $meta_key && empty( $meta_value ) ) {
$meta_keys = array( 'webmentions_disabled', 'webmentions_send_disabled' );

if ( \in_array( $meta_key, $meta_keys, true ) && empty( $meta_value ) ) {
if ( 'update_post_metadata' === current_action() ) {
\delete_post_meta( $object_id, $meta_key );
}
Expand Down
11 changes: 10 additions & 1 deletion src/editor-plugin/plugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,22 @@ const EditorPlugin = () => {
>
<CheckboxControl
__nextHasNoMarginBottom
label={ __( 'Disable Webmentions', 'webmention' ) }
label={ __( 'Disable incoming', 'webmention' ) }
help={ __( 'Do not accept incoming Webmentions for this post.', 'webmention' ) }
checked={ meta.webmentions_disabled }
onChange={ ( value ) => {
setMeta( { ...meta, webmentions_disabled: value } );
} }
/>
<CheckboxControl
__nextHasNoMarginBottom
label={ __( 'Disable outgoing', 'webmention' ) }
help={ __( 'Do not send Webmentions for this post.', 'webmention' ) }
checked={ meta.webmentions_send_disabled }
onChange={ ( value ) => {
setMeta( { ...meta, webmentions_send_disabled: value } );
} }
/>
</PluginDocumentSettingPanel>
);
}
Expand Down