From: Michael Date: Sat, 19 Jan 2019 16:44:15 +0000 (+0000) Subject: Transmit via BCC if contact is hidden, don't store announces X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=809e5560094ddd5cde9d7713bd7c628bba6d7f36;p=friendica.git Transmit via BCC if contact is hidden, don't store announces --- diff --git a/src/Protocol/ActivityPub/Receiver.php b/src/Protocol/ActivityPub/Receiver.php index ac75155b20..61e9f8e9c6 100644 --- a/src/Protocol/ActivityPub/Receiver.php +++ b/src/Protocol/ActivityPub/Receiver.php @@ -332,7 +332,10 @@ class Receiver return; } - self::storeConversation($object_data, $body); + // Only store content related stuff - and no announces, since they possibly overwrite the original content + if (in_array($object_data['object_type'], self::CONTENT_TYPES) && ($type != 'as:Announce')) { + self::storeConversation($object_data, $body); + } // Internal flag for thread completion. See Processor.php if (!empty($activity['thread-completion'])) { diff --git a/src/Protocol/ActivityPub/Transmitter.php b/src/Protocol/ActivityPub/Transmitter.php index 05d0c45867..be2337ff76 100644 --- a/src/Protocol/ActivityPub/Transmitter.php +++ b/src/Protocol/ActivityPub/Transmitter.php @@ -307,6 +307,16 @@ class Transmitter $last_id = $item['id']; } + $always_bcc = false; + + // Check if we should always deliver our stuff via BCC + if (!empty($item['uid'])) { + $profile = Profile::getByUID($item['uid']); + if (!empty($profile)) { + $always_bcc = $profile['hide-friends']; + } + } + // Will be activated in a later step // $networks = [Protocol::ACTIVITYPUB, Protocol::DFRN, Protocol::DIASPORA, Protocol::OSTATUS]; @@ -349,11 +359,13 @@ class Transmitter } foreach ($receiver_list as $receiver) { - $contact = DBA::selectFirst('contact', ['url'], ['id' => $receiver, 'network' => $networks]); + $contact = DBA::selectFirst('contact', ['url', 'hidden'], ['id' => $receiver, 'network' => $networks]); if (DBA::isResult($contact) && !empty($profile = APContact::getByURL($contact['url'], false))) { - // BCC is currently deactivated, due to Pleroma and Mastodon not reacting like expected - // $data['bcc'][] = $profile['url']; - $data['cc'][] = $profile['url']; + if ($contact['hidden'] || $always_bcc) { + $data['bcc'][] = $profile['url']; + } else { + $data['cc'][] = $profile['url']; + } } } }