finally fixed contact list

This commit is contained in:
Matthias Pfefferle 2019-02-19 22:43:14 +01:00
parent b4860943a5
commit b209104fdd
10 changed files with 40 additions and 22 deletions

View file

@ -3,8 +3,8 @@
**Donate link:** https://notiz.blog/donate/ **Donate link:** https://notiz.blog/donate/
**Tags:** OStatus, fediverse, activitypub, activitystream **Tags:** OStatus, fediverse, activitypub, activitystream
**Requires at least:** 4.7 **Requires at least:** 4.7
**Tested up to:** 5.1.0 **Tested up to:** 5.1
**Stable tag:** 0.4.0 **Stable tag:** 0.4.1
**Requires PHP:** 5.6 **Requires PHP:** 5.6
**License:** MIT **License:** MIT
**License URI:** http://opensource.org/licenses/MIT **License URI:** http://opensource.org/licenses/MIT
@ -55,6 +55,10 @@ To implement:
Project maintained on github at [pfefferle/wordpress-activitypub](https://github.com/pfefferle/wordpress-activitypub). Project maintained on github at [pfefferle/wordpress-activitypub](https://github.com/pfefferle/wordpress-activitypub).
### 0.4.1 ###
* finally fixed contact list
### 0.4.0 ### ### 0.4.0 ###
* added settings to enable/disable hashtag support * added settings to enable/disable hashtag support

View file

@ -3,7 +3,7 @@
* Plugin Name: ActivityPub * Plugin Name: ActivityPub
* Plugin URI: https://github.com/pfefferle/wordpress-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. * Description: The ActivityPub protocol is a decentralized social networking protocol based upon the ActivityStreams 2.0 data format.
* Version: 0.4.0 * Version: 0.4.1
* Author: Matthias Pfefferle * Author: Matthias Pfefferle
* Author URI: https://notiz.blog/ * Author URI: https://notiz.blog/
* License: MIT * License: MIT

0
bin/deploy.sh Normal file → Executable file
View file

0
bin/install-wp-tests.sh Normal file → Executable file
View file

View file

@ -6,6 +6,9 @@
"php": ">=5.3.0", "php": ">=5.3.0",
"composer/installers": "~1.0" "composer/installers": "~1.0"
}, },
"require-dev": {
"phpunit/phpunit": "^5.5"
},
"license": "MIT", "license": "MIT",
"authors": [ "authors": [
{ {

View file

@ -9,20 +9,15 @@ class Db_Activitypub_Followers {
return $followers; return $followers;
} }
if ( count( $array ) == count( $array, COUNT_RECURSIVE ) ) {
return $followers;
}
foreach ( $followers as $key => $follower ) { foreach ( $followers as $key => $follower ) {
if ( if (
is_array( $follower ) && is_array( $follower ) &&
isset( $follower['type'] ) && isset( $follower['type'] ) &&
'Person' === $follower['type'] && 'Person' === $follower['type'] &&
isset( $follower['id'] ) && isset( $follower['id'] ) &&
true === filter_var( $follower['id'], FILTER_VALIDATE_URL ) false !== filter_var( $follower['id'], FILTER_VALIDATE_URL )
) { ) {
unset( $followers[$key] ); $followers[$key] = $follower['id'];
$followers[] = $follower['id'];
} }
} }
@ -38,7 +33,7 @@ class Db_Activitypub_Followers {
isset( $actor['type'] ) && isset( $actor['type'] ) &&
'Person' === $actor['type'] && 'Person' === $actor['type'] &&
isset( $actor['id'] ) && isset( $actor['id'] ) &&
true === filter_var( $actor['id'], FILTER_VALIDATE_URL ) false !== filter_var( $actor['id'], FILTER_VALIDATE_URL )
) { ) {
$actor = $actor['id']; $actor = $actor['id'];
} }

View file

@ -2,9 +2,9 @@
# This file is distributed under the MIT. # This file is distributed under the MIT.
msgid "" msgid ""
msgstr "" msgstr ""
"Project-Id-Version: ActivityPub 0.4.0\n" "Project-Id-Version: ActivityPub 0.4.1\n"
"Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/activitypub\n" "Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/activitypub\n"
"POT-Creation-Date: 2019-02-17 20:46:19+00:00\n" "POT-Creation-Date: 2019-02-19 13:29:42+00:00\n"
"MIME-Version: 1.0\n" "MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=utf-8\n" "Content-Type: text/plain; charset=utf-8\n"
"Content-Transfer-Encoding: 8bit\n" "Content-Transfer-Encoding: 8bit\n"
@ -66,7 +66,7 @@ msgstr ""
msgid "Fediverse" msgid "Fediverse"
msgstr "" msgstr ""
#: includes/class-db-activitypub-followers.php:46 #: includes/class-db-activitypub-followers.php:41
msgid "Unknown Actor schema" msgid "Unknown Actor schema"
msgstr "" msgstr ""

View file

@ -3,8 +3,8 @@ Contributors: pfefferle
Donate link: https://notiz.blog/donate/ Donate link: https://notiz.blog/donate/
Tags: OStatus, fediverse, activitypub, activitystream Tags: OStatus, fediverse, activitypub, activitystream
Requires at least: 4.7 Requires at least: 4.7
Tested up to: 5.1.0 Tested up to: 5.1
Stable tag: 0.4.0 Stable tag: 0.4.1
Requires PHP: 5.6 Requires PHP: 5.6
License: MIT License: MIT
License URI: http://opensource.org/licenses/MIT License URI: http://opensource.org/licenses/MIT
@ -55,6 +55,10 @@ To implement:
Project maintained on github at [pfefferle/wordpress-activitypub](https://github.com/pfefferle/wordpress-activitypub). Project maintained on github at [pfefferle/wordpress-activitypub](https://github.com/pfefferle/wordpress-activitypub).
= 0.4.1 =
* finally fixed contact list
= 0.4.0 = = 0.4.0 =
* added settings to enable/disable hashtag support * added settings to enable/disable hashtag support

View file

@ -0,0 +1,18 @@
<?php
class Test_Db_Activitypub_Followers extends WP_UnitTestCase {
public function test_get_followers() {
$followers = array( 'https://example.com/author/jon', 'https://example.org/author/doe' );
$followers[] = array(
'type' => 'Person',
'id' => 'http://sally.example.org',
'name' => 'Sally Smith',
);
update_user_meta( 1, 'activitypub_followers', $followers );
$db_followers = Db_Activitypub_Followers::get_followers( 1 );
$this->assertEquals( 3, count( $db_followers ) );
$this->assertSame( array( 'https://example.com/author/jon', 'https://example.org/author/doe', 'http://sally.example.org' ), $db_followers );
}
}

View file

@ -1,6 +0,0 @@
<?php
class Test extends WP_UnitTestCase {
public function test() {
$this->assertTrue( true );
}
}