Prevent sending forum posts via AP

This commit is contained in:
Michael 2020-08-10 19:44:37 +00:00
parent 2c97e2190b
commit 25ea15de64
2 changed files with 35 additions and 5 deletions

View file

@ -356,12 +356,14 @@ class Transmitter
}
$always_bcc = false;
$isforum = false;
// Check if we should always deliver our stuff via BCC
if (!empty($item['uid'])) {
$profile = Profile::getByUID($item['uid']);
$profile = User::getOwnerDataById($item['uid']);
if (!empty($profile)) {
$always_bcc = $profile['hide-friends'];
$isforum = $profile['account-type'] == User::ACCOUNT_TYPE_COMMUNITY;
}
}
@ -369,7 +371,7 @@ class Transmitter
$always_bcc = true;
}
if (self::isAnnounce($item) || DI::config()->get('debug', 'total_ap_delivery')) {
if ((self::isAnnounce($item) && !$isforum) || DI::config()->get('debug', 'total_ap_delivery')) {
// Will be activated in a later step
$networks = Protocol::FEDERATED;
} else {
@ -423,6 +425,10 @@ class Transmitter
continue;
}
if ($isforum && DBA::isResult($contact) && ($contact['dfrn'] == Protocol::DFRN)) {
continue;
}
if (!empty($profile = APContact::getByURL($contact['url'], false))) {
$data['to'][] = $profile['url'];
}
@ -435,6 +441,10 @@ class Transmitter
continue;
}
if ($isforum && DBA::isResult($contact) && ($contact['dfrn'] == Protocol::DFRN)) {
continue;
}
if (!empty($profile = APContact::getByURL($contact['url'], false))) {
if ($contact['hidden'] || $always_bcc) {
$data['bcc'][] = $profile['url'];
@ -557,6 +567,15 @@ class Transmitter
{
$inboxes = [];
$isforum = false;
if (!empty($item['uid'])) {
$profile = User::getOwnerDataById($item['uid']);
if (!empty($profile)) {
$isforum = $profile['account-type'] == User::ACCOUNT_TYPE_COMMUNITY;
}
}
if (DI::config()->get('debug', 'total_ap_delivery')) {
// Will be activated in a later step
$networks = Protocol::FEDERATED;
@ -581,6 +600,10 @@ class Transmitter
continue;
}
if ($isforum && ($contact['dfrn'] == Protocol::DFRN)) {
continue;
}
if (Network::isUrlBlocked($contact['url'])) {
continue;
}