From: Michael Date: Tue, 16 Jul 2019 05:07:26 +0000 (+0000) Subject: Issue 7315: Set the forum's contact id for forum posts X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=8c2f50eb72f976b4f8f2cdd105fa7718304a1c56;p=friendica.git Issue 7315: Set the forum's contact id for forum posts --- diff --git a/src/Protocol/ActivityPub/Processor.php b/src/Protocol/ActivityPub/Processor.php index 6ba0c8f848..f2aae6af2d 100644 --- a/src/Protocol/ActivityPub/Processor.php +++ b/src/Protocol/ActivityPub/Processor.php @@ -373,6 +373,8 @@ class Processor $item['owner-link'] = $activity['actor']; $item['owner-id'] = Contact::getIdForURL($activity['actor'], 0, true); + $isForum = false; + if (!empty($activity['thread-completion'])) { // Store the original actor in the "causer" fields to enable the check for ignored or blocked contacts $item['causer-link'] = $item['owner-link']; @@ -381,6 +383,9 @@ class Processor Logger::info('Ignoring actor because of thread completion.', ['actor' => $item['owner-link']]); $item['owner-link'] = $item['author-link']; $item['owner-id'] = $item['author-id']; + } else { + $actor = APContact::getByURL($item['owner-link'], false); + $isForum = ($actor['type'] == 'Group'); } $item['uri'] = $activity['id']; @@ -402,7 +407,14 @@ class Processor foreach ($activity['receiver'] as $receiver) { $item['uid'] = $receiver; - $item['contact-id'] = Contact::getIdForURL($activity['author'], $receiver, true); + + if ($isForum) { + $item['contact-id'] = Contact::getIdForURL($activity['actor'], $receiver, true); + } + + if (empty($item['contact-id'])) { + $item['contact-id'] = Contact::getIdForURL($activity['author'], $receiver, true); + } if (($receiver != 0) && empty($item['contact-id'])) { $item['contact-id'] = Contact::getIdForURL($activity['author'], 0, true);