Merge pull request #6185 from annando/blocked

Checking for blocked user does now check for blocked domain as well
This commit is contained in:
Hypolite Petovan 2018-11-22 18:38:14 -05:00 committed by GitHub
commit 2b7f57453b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 20 additions and 1 deletions

View File

@ -1285,10 +1285,15 @@ class Contact extends BaseObject
return false;
}
$blocked = DBA::selectFirst('contact', ['blocked'], ['id' => $cid]);
$blocked = DBA::selectFirst('contact', ['blocked', 'url'], ['id' => $cid]);
if (!DBA::isResult($blocked)) {
return false;
}
if (Network::isUrlBlocked($blocked['url'])) {
return true;
}
return (bool) $blocked['blocked'];
}

View File

@ -27,6 +27,7 @@ use Friendica\Protocol\ActivityPub;
use Friendica\Protocol\Diaspora;
use Friendica\Core\Cache;
use Friendica\Util\Map;
use Friendica\Util\Network;
require_once 'include/api.php';
@ -446,6 +447,10 @@ class Transmitter
$contacts = DBA::select('contact', ['url'], $condition);
while ($contact = DBA::fetch($contacts)) {
if (Network::isUrlBlocked($contact['url'])) {
continue;
}
$profile = APContact::getByURL($contact['url'], false);
if (!empty($profile)) {
if (empty($profile['sharedinbox']) || $personal) {
@ -493,6 +498,10 @@ class Transmitter
$blindcopy = in_array($element, ['bto', 'bcc']);
foreach ($permissions[$element] as $receiver) {
if (Network::isUrlBlocked($receiver)) {
continue;
}
if ($receiver == $item_profile['followers']) {
$inboxes = array_merge($inboxes, self::fetchTargetInboxesforUser($uid, $personal));
} else {

View File

@ -19,6 +19,7 @@ use Friendica\Protocol\DFRN;
use Friendica\Protocol\Diaspora;
use Friendica\Protocol\Email;
use Friendica\Util\Strings;
use Friendica\Util\Network;
require_once 'include/items.php';
@ -158,6 +159,10 @@ class Delivery extends BaseObject
return;
}
if (Network::isUrlBlocked($contact['url'])) {
return;
}
// Transmit via Diaspora if the thread had started as Diaspora post
// This is done since the uri wouldn't match (Diaspora doesn't transmit it)
if (isset($parent) && ($parent['network'] == Protocol::DIASPORA) && ($contact['network'] == Protocol::DFRN)) {