From 2365193691123b88d5401416f0c98c5d880c4305 Mon Sep 17 00:00:00 2001 From: Michael Vogel Date: Sun, 5 May 2019 11:17:45 +0200 Subject: [PATCH] AP: Support of request messages --- src/Model/Contact.php | 4 ++-- src/Protocol/ActivityPub/Processor.php | 4 +++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/Model/Contact.php b/src/Model/Contact.php index 5d62383dc1..059a65e57c 100644 --- a/src/Model/Contact.php +++ b/src/Model/Contact.php @@ -2085,7 +2085,7 @@ class Contact extends BaseObject return $contact; } - public static function addRelationship($importer, $contact, $datarray, $item = '', $sharing = false) { + public static function addRelationship($importer, $contact, $datarray, $item = '', $sharing = false, $note = '') { // Should always be set if (empty($datarray['author-id'])) { return; @@ -2163,7 +2163,7 @@ class Contact extends BaseObject if (is_array($contact_record)) { DBA::insert('intro', ['uid' => $importer['uid'], 'contact-id' => $contact_record['id'], - 'blocked' => false, 'knowyou' => false, + 'blocked' => false, 'knowyou' => false, 'note' => $note, 'hash' => $hash, 'datetime' => DateTimeFormat::utcNow()]); } diff --git a/src/Protocol/ActivityPub/Processor.php b/src/Protocol/ActivityPub/Processor.php index 5892048701..15ec610e50 100644 --- a/src/Protocol/ActivityPub/Processor.php +++ b/src/Protocol/ActivityPub/Processor.php @@ -463,10 +463,12 @@ class Processor $item = ['author-id' => Contact::getIdForURL($activity['actor']), 'author-link' => $activity['actor']]; + $note = Strings::escapeTags(trim(defaults($activity, 'content', ''))); + // Ensure that the contact has got the right network type self::switchContact($item['author-id']); - Contact::addRelationship($owner, $contact, $item); + Contact::addRelationship($owner, $contact, $item, '', false, $note); $cid = Contact::getIdForURL($activity['actor'], $uid); if (empty($cid)) { return; -- 2.39.5