summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYury German <blueknight@gentoo.org>2019-04-28 17:39:03 -0400
committerYury German <blueknight@gentoo.org>2019-04-28 17:39:03 -0400
commit2ab16973706e120bc344c83be6295b54fd908c57 (patch)
tree358267a52d9542c77c90e3663cea32d13b8cb639 /plugins/jetpack/json-endpoints/class.wpcom-json-api-update-post-v1-1-endpoint.php
parentUpdate twentysixteen 1.7 (diff)
downloadblogs-gentoo-2ab16973706e120bc344c83be6295b54fd908c57.tar.gz
blogs-gentoo-2ab16973706e120bc344c83be6295b54fd908c57.tar.bz2
blogs-gentoo-2ab16973706e120bc344c83be6295b54fd908c57.zip
Updating packages for 5.1.1
Signed-off-by: Yury German <blueknight@gentoo.org>
Diffstat (limited to 'plugins/jetpack/json-endpoints/class.wpcom-json-api-update-post-v1-1-endpoint.php')
-rw-r--r--plugins/jetpack/json-endpoints/class.wpcom-json-api-update-post-v1-1-endpoint.php12
1 files changed, 4 insertions, 8 deletions
diff --git a/plugins/jetpack/json-endpoints/class.wpcom-json-api-update-post-v1-1-endpoint.php b/plugins/jetpack/json-endpoints/class.wpcom-json-api-update-post-v1-1-endpoint.php
index 1e1a1f1b..3778f16d 100644
--- a/plugins/jetpack/json-endpoints/class.wpcom-json-api-update-post-v1-1-endpoint.php
+++ b/plugins/jetpack/json-endpoints/class.wpcom-json-api-update-post-v1-1-endpoint.php
@@ -615,7 +615,7 @@ class WPCOM_JSON_API_Update_Post_v1_1_Endpoint extends WPCOM_JSON_API_Post_v1_1_
if ( $new ) {
if ( $sitewide_likes_enabled ) {
if ( false === $likes ) {
- update_post_meta( $post_id, 'switch_like_status', 1 );
+ update_post_meta( $post_id, 'switch_like_status', 0 );
} else {
delete_post_meta( $post_id, 'switch_like_status' );
}
@@ -630,7 +630,7 @@ class WPCOM_JSON_API_Update_Post_v1_1_Endpoint extends WPCOM_JSON_API_Post_v1_1_
if ( isset( $likes ) ) {
if ( $sitewide_likes_enabled ) {
if ( false === $likes ) {
- update_post_meta( $post_id, 'switch_like_status', 1 );
+ update_post_meta( $post_id, 'switch_like_status', 0 );
} else {
delete_post_meta( $post_id, 'switch_like_status' );
}
@@ -825,7 +825,6 @@ class WPCOM_JSON_API_Update_Post_v1_1_Endpoint extends WPCOM_JSON_API_Post_v1_1_
switch ( $meta->operation ) {
case 'delete':
-
if ( ! empty( $meta->id ) && ! empty( $existing_meta_item->meta_key ) && current_user_can( 'delete_post_meta', $post_id, $unslashed_existing_meta_key ) ) {
delete_metadata_by_mid( 'post', $meta->id );
} elseif ( ! empty( $meta->key ) && ! empty( $meta->previous_value ) && current_user_can( 'delete_post_meta', $post_id, $unslashed_meta_key ) ) {
@@ -836,18 +835,16 @@ class WPCOM_JSON_API_Update_Post_v1_1_Endpoint extends WPCOM_JSON_API_Post_v1_1_
break;
case 'add':
-
if ( ! empty( $meta->id ) || ! empty( $meta->previous_value ) ) {
- continue;
+ break;
} elseif ( ! empty( $meta->key ) && ! empty( $meta->value ) && ( current_user_can( 'add_post_meta', $post_id, $unslashed_meta_key ) ) || WPCOM_JSON_API_Metadata::is_public( $meta->key ) ) {
add_post_meta( $post_id, $meta->key, $meta->value );
}
break;
case 'update':
-
if ( ! isset( $meta->value ) ) {
- continue;
+ break;
} elseif ( ! empty( $meta->id ) && ! empty( $existing_meta_item->meta_key ) && ( current_user_can( 'edit_post_meta', $post_id, $unslashed_existing_meta_key ) || WPCOM_JSON_API_Metadata::is_public( $meta->key ) ) ) {
update_metadata_by_mid( 'post', $meta->id, $meta->value );
} elseif ( ! empty( $meta->key ) && ! empty( $meta->previous_value ) && ( current_user_can( 'edit_post_meta', $post_id, $unslashed_meta_key ) || WPCOM_JSON_API_Metadata::is_public( $meta->key ) ) ) {
@@ -858,7 +855,6 @@ class WPCOM_JSON_API_Update_Post_v1_1_Endpoint extends WPCOM_JSON_API_Post_v1_1_
break;
}
-
}
}