Add/small improvements (#384)
* flush rewrite rules after migration * some activity improvements * equate usernames with and without `.` Can we equate `@notiz.blog@notiz.blog` with `@notizblog@notiz.blog`? * better NodeInfo compatibility check * fix `extract_name_from_uri` * reset user check * re-added action * fix check
This commit is contained in:
parent
9d30c413f0
commit
3afed5b296
6 changed files with 19 additions and 5 deletions
|
@ -26,6 +26,7 @@ class Activity extends Base_Object {
|
|||
'schema' => 'http://schema.org#',
|
||||
'pt' => 'https://joinpeertube.org/ns#',
|
||||
'toot' => 'http://joinmastodon.org/ns#',
|
||||
'litepub' => 'http://litepub.social/ns#',
|
||||
'value' => 'schema:value',
|
||||
'Hashtag' => 'as:Hashtag',
|
||||
'featured' => array(
|
||||
|
@ -36,6 +37,8 @@ class Activity extends Base_Object {
|
|||
'@id' => 'toot:featuredTags',
|
||||
'@type' => '@id',
|
||||
),
|
||||
'discoverable' => 'toot:discoverable',
|
||||
'sensitive' => 'as:sensitive',
|
||||
),
|
||||
);
|
||||
|
||||
|
|
|
@ -627,7 +627,7 @@ class Base_Object {
|
|||
}
|
||||
|
||||
// if value is empty, try to get it from a getter.
|
||||
if ( ! isset( $value ) ) {
|
||||
if ( ! $value ) {
|
||||
$value = call_user_func( array( $this, 'get_' . $key ) );
|
||||
}
|
||||
|
||||
|
@ -636,7 +636,7 @@ class Base_Object {
|
|||
}
|
||||
|
||||
// if value is still empty, ignore it for the array and continue.
|
||||
if ( isset( $value ) ) {
|
||||
if ( $value ) {
|
||||
$array[ snake_to_camel_case( $key ) ] = $value;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -216,7 +216,7 @@ class Activitypub {
|
|||
);
|
||||
}
|
||||
|
||||
if ( ! \class_exists( 'Nodeinfo' ) && true === (bool) \get_option( 'blog_public', 1 ) ) {
|
||||
if ( ! \class_exists( 'Nodeinfo_Endpoint' ) && true === (bool) \get_option( 'blog_public', 1 ) ) {
|
||||
\add_rewrite_rule(
|
||||
'^.well-known/nodeinfo',
|
||||
'index.php?rest_route=/' . ACTIVITYPUB_REST_NAMESPACE . '/nodeinfo/discovery',
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
<?php
|
||||
namespace Activitypub;
|
||||
|
||||
use Activitypub\Activitypub;
|
||||
use Activitypub\Model\Blog_User;
|
||||
use Activitypub\Collection\Followers;
|
||||
|
||||
|
@ -135,6 +136,8 @@ class Migration {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
Activitypub::flush_rewrite_rules();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -87,6 +87,7 @@ class Users {
|
|||
'number' => 1,
|
||||
'hide_empty' => true,
|
||||
'fields' => 'ID',
|
||||
// phpcs:ignore WordPress.DB.SlowDBQuery.slow_db_query_meta_query
|
||||
'meta_query' => array(
|
||||
'relation' => 'OR',
|
||||
array(
|
||||
|
|
|
@ -23,6 +23,13 @@ class Blog_User extends User {
|
|||
*/
|
||||
protected $type = 'Group';
|
||||
|
||||
/**
|
||||
* Is Account discoverable?
|
||||
*
|
||||
* @var boolean
|
||||
*/
|
||||
protected $discoverable = true;
|
||||
|
||||
public static function from_wp_user( $user_id ) {
|
||||
if ( is_user_disabled( $user_id ) ) {
|
||||
return new WP_Error(
|
||||
|
|
Loading…
Reference in a new issue