-
Notifications
You must be signed in to change notification settings - Fork 83
Remove actor mode setting in favor of capability-based actors #2420
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
base: trunk
Are you sure you want to change the base?
Changes from 3 commits
e469d95
b1bcb92
866cd57
2ecd9c7
5e4d89b
4bf2159
eb711e8
ba3744d
7e8db6e
6ab384e
b61c0a5
8396876
2a4b34d
dfb1c79
7af1f6d
5bec5eb
0841201
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||
|---|---|---|---|---|---|---|---|---|
|
|
@@ -368,7 +368,7 @@ function user_can_activitypub( $user_id ) { | |||||||
| break; | ||||||||
|
|
||||||||
| case Actors::BLOG_USER_ID: | ||||||||
| $enabled = ! is_user_type_disabled( 'blog' ); | ||||||||
| $enabled = true; // Blog user is always enabled. | ||||||||
pfefferle marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||||||||
| break; | ||||||||
|
|
||||||||
| default: | ||||||||
|
|
@@ -377,11 +377,7 @@ function user_can_activitypub( $user_id ) { | |||||||
| break; | ||||||||
| } | ||||||||
|
|
||||||||
| if ( is_user_type_disabled( 'user' ) ) { | ||||||||
| $enabled = false; | ||||||||
| break; | ||||||||
| } | ||||||||
|
|
||||||||
| // Check only the capability. | ||||||||
| $enabled = \user_can( $user_id, 'activitypub' ); | ||||||||
| } | ||||||||
|
|
||||||||
|
|
@@ -400,64 +396,30 @@ function user_can_activitypub( $user_id ) { | |||||||
| * This function is used to check if the 'blog' or 'user' | ||||||||
| * type is disabled for ActivityPub. | ||||||||
| * | ||||||||
| * Note: As of version 4.6.0, blog actors are always enabled and user actors | ||||||||
pfefferle marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||||||||
| * are controlled via the 'activitypub' capability. This function now always | ||||||||
| * returns false but is maintained for backward compatibility and filter support. | ||||||||
| * | ||||||||
| * @param string $type User type. 'blog' or 'user'. | ||||||||
| * | ||||||||
| * @return boolean True if the user type is disabled, false otherwise. | ||||||||
| * @return boolean Always returns false (no types are globally disabled). | ||||||||
| */ | ||||||||
| function is_user_type_disabled( $type ) { | ||||||||
| switch ( $type ) { | ||||||||
| case 'blog': | ||||||||
| if ( \defined( 'ACTIVITYPUB_SINGLE_USER_MODE' ) ) { | ||||||||
| if ( ACTIVITYPUB_SINGLE_USER_MODE ) { | ||||||||
| $disabled = false; | ||||||||
| break; | ||||||||
| } | ||||||||
| } | ||||||||
|
|
||||||||
| if ( \defined( 'ACTIVITYPUB_DISABLE_BLOG_USER' ) ) { | ||||||||
| $disabled = ACTIVITYPUB_DISABLE_BLOG_USER; | ||||||||
| break; | ||||||||
| } | ||||||||
|
|
||||||||
| if ( ACTIVITYPUB_ACTOR_MODE === \get_option( 'activitypub_actor_mode', ACTIVITYPUB_ACTOR_MODE ) ) { | ||||||||
| $disabled = true; | ||||||||
| break; | ||||||||
| } | ||||||||
|
|
||||||||
| $disabled = false; | ||||||||
| break; | ||||||||
| case 'user': | ||||||||
| if ( \defined( 'ACTIVITYPUB_SINGLE_USER_MODE' ) ) { | ||||||||
| if ( ACTIVITYPUB_SINGLE_USER_MODE ) { | ||||||||
| $disabled = true; | ||||||||
| break; | ||||||||
| } | ||||||||
| } | ||||||||
|
|
||||||||
| if ( \defined( 'ACTIVITYPUB_DISABLE_USER' ) ) { | ||||||||
| $disabled = ACTIVITYPUB_DISABLE_USER; | ||||||||
| break; | ||||||||
| } | ||||||||
|
|
||||||||
| if ( ACTIVITYPUB_BLOG_MODE === \get_option( 'activitypub_actor_mode', ACTIVITYPUB_ACTOR_MODE ) ) { | ||||||||
| $disabled = true; | ||||||||
| break; | ||||||||
| } | ||||||||
| $disabled = false; | ||||||||
|
|
||||||||
| $disabled = false; | ||||||||
| break; | ||||||||
| default: | ||||||||
| $disabled = new \WP_Error( | ||||||||
| 'activitypub_wrong_user_type', | ||||||||
| __( 'Wrong user type', 'activitypub' ), | ||||||||
| array( 'status' => 400 ) | ||||||||
| ); | ||||||||
| break; | ||||||||
| if ( ! in_array( $type, array( 'blog', 'user' ), true ) ) { | ||||||||
| $disabled = new \WP_Error( | ||||||||
| 'activitypub_wrong_user_type', | ||||||||
| __( 'Wrong user type', 'activitypub' ), | ||||||||
| array( 'status' => 400 ) | ||||||||
| ); | ||||||||
| } | ||||||||
|
|
||||||||
| /** | ||||||||
| * Allow plugins to disable user types for ActivityPub. | ||||||||
| * | ||||||||
| * Note: This filter is deprecated. Use capability management instead. | ||||||||
| * | ||||||||
| * @param boolean $disabled True if the user type is disabled, false otherwise. | ||||||||
| * @param string $type The User-Type. | ||||||||
|
||||||||
| * @param string $type The User-Type. | |
| * @param string $type The User-Type. | |
| * @deprecated unreleased |
Uh oh!
There was an error while loading. Please reload this page.