Skip to content

Commit bb730fa

Browse files
committed
Disable outgoing Webmentions
fix #524
1 parent 4c8cc8b commit bb730fa

File tree

5 files changed

+24
-4
lines changed

5 files changed

+24
-4
lines changed
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
<?php return array('dependencies' => array('react', 'wp-components', 'wp-core-data', 'wp-data', 'wp-editor', 'wp-i18n', 'wp-plugins'), 'version' => '03845d869ccb1b1eb23c');
1+
<?php return array('dependencies' => array('react', 'wp-components', 'wp-core-data', 'wp-data', 'wp-editor', 'wp-i18n', 'wp-plugins'), 'version' => '5b3078e57362374cb01e');

build/editor-plugin/plugin.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

includes/class-block.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,15 @@ public static function register_postmeta() {
2727
'type' => 'boolean',
2828
)
2929
);
30+
\register_post_meta(
31+
$post_type,
32+
'webmentions_send_disabled',
33+
array(
34+
'show_in_rest' => true,
35+
'single' => true,
36+
'type' => 'boolean',
37+
)
38+
);
3039
}
3140
}
3241

includes/class-webmention.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,9 @@ public function enqueue_scripts() {
197197
* @param mixed $meta_value The meta value.
198198
*/
199199
public function maybe_bypass_webmentions_disabled( $check, $object_id, $meta_key, $meta_value ) {
200-
if ( 'webmentions_disabled' === $meta_key && empty( $meta_value ) ) {
200+
$meta_keys = array( 'webmentions_disabled', 'webmentions_send_disabled' );
201+
202+
if ( \in_array( $meta_key, $meta_keys, true ) && empty( $meta_value ) ) {
201203
if ( 'update_post_metadata' === current_action() ) {
202204
\delete_post_meta( $object_id, $meta_key );
203205
}

src/editor-plugin/plugin.js

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,22 @@ const EditorPlugin = () => {
2020
>
2121
<CheckboxControl
2222
__nextHasNoMarginBottom
23-
label={ __( 'Disable Webmentions', 'webmention' ) }
23+
label={ __( 'Disable incoming', 'webmention' ) }
2424
help={ __( 'Do not accept incoming Webmentions for this post.', 'webmention' ) }
2525
checked={ meta.webmentions_disabled }
2626
onChange={ ( value ) => {
2727
setMeta( { ...meta, webmentions_disabled: value } );
2828
} }
2929
/>
30+
<CheckboxControl
31+
__nextHasNoMarginBottom
32+
label={ __( 'Disable outgoing', 'webmention' ) }
33+
help={ __( 'Do not send Webmentions for this post.', 'webmention' ) }
34+
checked={ meta.webmentions_send_disabled }
35+
onChange={ ( value ) => {
36+
setMeta( { ...meta, webmentions_send_disabled: value } );
37+
} }
38+
/>
3039
</PluginDocumentSettingPanel>
3140
);
3241
}

0 commit comments

Comments
 (0)