From c180644ccc9251114714da5d0006db8d0a215970 Mon Sep 17 00:00:00 2001 From: Matthias Pfefferle Date: Mon, 9 Sep 2024 12:54:57 +0200 Subject: [PATCH] Fix Extra-Fields handling (#886) --- CHANGELOG.md | 7 +++++++ README.md | 6 +++++- activitypub.php | 4 ++-- includes/class-admin.php | 2 +- includes/collection/class-extra-fields.php | 22 ++++++++++++++++++++++ readme.txt | 6 +++++- 6 files changed, 42 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f602a586..a398f13c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [3.2.2] - 2024-09-09 + +### Fixed + +* Fixed: Extra-Fields check + ## [3.2.1] - 2024-09-09 ### Fixed @@ -891,6 +897,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 * initial +[3.2.2]: https://github.com/Automattic/wordpress-activitypub/compare/3.2.1...3.2.2 [3.2.1]: https://github.com/Automattic/wordpress-activitypub/compare/3.2.0...3.2.1 [3.2.0]: https://github.com/Automattic/wordpress-activitypub/compare/3.1.0...3.2.0 [3.1.0]: https://github.com/Automattic/wordpress-activitypub/compare/3.0.0...3.1.0 diff --git a/README.md b/README.md index afebb221..5151e521 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,7 @@ **Tags:** OStatus, fediverse, activitypub, activitystream **Requires at least:** 5.5 **Tested up to:** 6.6 -**Stable tag:** 3.2.1 +**Stable tag:** 3.2.2 **Requires PHP:** 7.0 **License:** MIT **License URI:** http://opensource.org/licenses/MIT @@ -134,6 +134,10 @@ For reasons of data protection, it is not possible to see the followers of other ## Changelog ## +### 3.2.2 ### + +* Fixed: Extra-Fields check + ### 3.2.1 ### * Fixed: Use `Excerpt` for Podcast Episodes diff --git a/activitypub.php b/activitypub.php index 93d30d59..83692972 100644 --- a/activitypub.php +++ b/activitypub.php @@ -3,7 +3,7 @@ * Plugin Name: ActivityPub * Plugin URI: https://github.com/pfefferle/wordpress-activitypub/ * Description: The ActivityPub protocol is a decentralized social networking protocol based upon the ActivityStreams 2.0 data format. - * Version: 3.2.1 + * Version: 3.2.2 * Author: Matthias Pfefferle & Automattic * Author URI: https://automattic.com/ * License: MIT @@ -21,7 +21,7 @@ use function Activitypub\site_supports_blocks; require_once __DIR__ . '/includes/compat.php'; require_once __DIR__ . '/includes/functions.php'; -\define( 'ACTIVITYPUB_PLUGIN_VERSION', '3.2.1' ); +\define( 'ACTIVITYPUB_PLUGIN_VERSION', '3.2.2' ); /** * Initialize the plugin constants. diff --git a/includes/class-admin.php b/includes/class-admin.php index 3fe393f2..7fb05741 100644 --- a/includes/class-admin.php +++ b/includes/class-admin.php @@ -498,7 +498,7 @@ class Admin { $post = get_post( $arg[2] ); - if ( Extra_Fields::is_extra_fields_post_type( $post->post_type ) ) { + if ( ! Extra_Fields::is_extra_field_post_type( $post->post_type ) ) { return $allcaps; } diff --git a/includes/collection/class-extra-fields.php b/includes/collection/class-extra-fields.php index 6e4aad4b..b7668c08 100644 --- a/includes/collection/class-extra-fields.php +++ b/includes/collection/class-extra-fields.php @@ -130,6 +130,28 @@ class Extra_Fields { return \in_array( $post_type, array( self::USER_POST_TYPE, self::BLOG_POST_TYPE ), true ); } + /** + * Check if a post type is the `ap_extrafield` post type. + * + * @param string $post_type The post type. + * + * @return bool True if the post type is `ap_extrafield`, otherwise false. + */ + public static function is_extra_field_post_type( $post_type ) { + return self::USER_POST_TYPE === $post_type; + } + + /** + * Check if a post type is the `ap_extrafield_blog` post type. + * + * @param string $post_type The post type. + * + * @return bool True if the post type is `ap_extrafield_blog`, otherwise false. + */ + public static function is_extra_field_blog_post_type( $post_type ) { + return self::BLOG_POST_TYPE === $post_type; + } + /** * Add default extra fields to an actor. * diff --git a/readme.txt b/readme.txt index d5f59d75..a9068e6c 100644 --- a/readme.txt +++ b/readme.txt @@ -3,7 +3,7 @@ Contributors: automattic, pfefferle, mediaformat, mattwiebe, akirk, jeherve, nur Tags: OStatus, fediverse, activitypub, activitystream Requires at least: 5.5 Tested up to: 6.6 -Stable tag: 3.2.1 +Stable tag: 3.2.2 Requires PHP: 7.0 License: MIT License URI: http://opensource.org/licenses/MIT @@ -134,6 +134,10 @@ For reasons of data protection, it is not possible to see the followers of other == Changelog == += 3.2.2 = + +* Fixed: Extra-Fields check + = 3.2.1 = * Fixed: Use `Excerpt` for Podcast Episodes