From 4d4af4f1b5f249708ac7877dd99c2ceb458ef8ba Mon Sep 17 00:00:00 2001 From: zotlabs Date: Thu, 26 Sep 2019 17:05:30 -0700 Subject: [PATCH] nomadic and trheading updates --- Zotlabs/Lib/Activity.php | 6 +++++- Zotlabs/Lib/ThreadItem.php | 42 +++++++++++++++++++++++++++---------- Zotlabs/Module/Apschema.php | 4 +++- boot.php | 2 +- 4 files changed, 40 insertions(+), 14 deletions(-) diff --git a/Zotlabs/Lib/Activity.php b/Zotlabs/Lib/Activity.php index 10a1dba7f..c99984bdd 100644 --- a/Zotlabs/Lib/Activity.php +++ b/Zotlabs/Lib/Activity.php @@ -978,7 +978,11 @@ class Activity { } if ($locations) { - $ret['zot:alsoKnownAs'] = $locations; + if (count($locations) === 1) { + $locations = array_shift($locations); + } + $ret['copiedTo'] = $locations; + $ret['alsoKnownAs'] = $locations; } $cp = get_cover_photo($c['channel_id'],'array'); diff --git a/Zotlabs/Lib/ThreadItem.php b/Zotlabs/Lib/ThreadItem.php index f988d6dbe..784c65b13 100644 --- a/Zotlabs/Lib/ThreadItem.php +++ b/Zotlabs/Lib/ThreadItem.php @@ -941,22 +941,42 @@ class ThreadItem { // present friend-of-friend conversations from hyperdrive as relayed posts from the first friend // we find among the respondents. - if($this->is_toplevel() && (! $this->data['owner']['abook_id'])) { - $children = $this->data['children']; - if($children) { - foreach($children as $child) { - if($child['author']['abook_id'] && (! intval($child['author']['abook_self']))) { - $this->owner_url = chanlink_hash($child['author']['xchan_hash']); - $this->owner_photo = $child['author']['xchan_photo_m']; - $this->owner_name = $child['author']['xchan_name']; - $this->wall_to_wall = true; - break; - } + if ($this->is_toplevel() && (! $this->data['owner']['abook_id'])) { + if ($this->data['children']) { + $friend = $this->find_a_friend($this->data['children']); + if ($friend) { + $this->owner_url = $friend['url']; + $this->owner_photo = $friend['photo']; + $this->owner_name = $friend['name']; + $this->wall_to_wall = true; } } } } + private function find_a_friend($items) { + $ret = null; + if ($items) { + foreach ($items as $child) { + if ($child['author']['abook_id'] && (! intval($child['author']['abook_self']))) { + return [ + 'url' => chanlink_hash($child['author']['xchan_hash']), + 'photo' => $child['author']['xchan_photo_m'], + 'name' => $child['author']['xchan_name'] + ]; + if ($child['children']) { + $ret = $this->find_a_friend($child['children']); + if ($ret) { + break; + } + } + } + } + } + return $ret; + } + + private function is_wall_to_wall() { return $this->wall_to_wall; } diff --git a/Zotlabs/Module/Apschema.php b/Zotlabs/Module/Apschema.php index 305f8f629..d2dbefe8a 100644 --- a/Zotlabs/Module/Apschema.php +++ b/Zotlabs/Module/Apschema.php @@ -17,6 +17,9 @@ class Apschema extends \Zotlabs\Web\Controller { 'ostatus' => 'http://ostatus.org#', 'conversation' => 'ostatus:conversation', 'sensitive' => 'as:sensitive', + 'movedTo' => 'as:movedTo', + 'copiedTo' => 'as:copiedTo', + 'alsoKnownAs' => 'as:alsoKnownAs', 'inheritPrivacy' => 'as:inheritPrivacy', 'commentPolicy' => 'zot:commentPolicy', 'topicalCollection' => 'zot:topicalCollection', @@ -24,7 +27,6 @@ class Apschema extends \Zotlabs\Web\Controller { 'emojiReaction' => 'zot:emojiReaction', 'expires' => 'zot:expires', 'directMessage' => 'zot:directMessage', - 'alsoKnownAs' => 'zot:alsoKnownAs', 'replyTo' => 'zot:replyTo' ] ]; diff --git a/boot.php b/boot.php index 09beb2a37..6871dde6f 100755 --- a/boot.php +++ b/boot.php @@ -470,7 +470,7 @@ define ( 'NAMESPACE_YMEDIA', 'http://search.yahoo.com/mrss/' ); define ( 'ACTIVITYSTREAMS_JSONLD_REV', 'https://www.w3.org/ns/activitystreams' ); -define ( 'ZOT_APSCHEMA_REV', '/apschema/v1.12' ); +define ( 'ZOT_APSCHEMA_REV', '/apschema/v1.13' ); /** * activity stream defines