1
0
Fork 0

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; return false;
} }
$blocked = DBA::selectFirst('contact', ['blocked'], ['id' => $cid]); $blocked = DBA::selectFirst('contact', ['blocked', 'url'], ['id' => $cid]);
if (!DBA::isResult($blocked)) { if (!DBA::isResult($blocked)) {
return false; return false;
} }
if (Network::isUrlBlocked($blocked['url'])) {
return true;
}
return (bool) $blocked['blocked']; return (bool) $blocked['blocked'];
} }

View file

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

View file

@ -19,6 +19,7 @@ use Friendica\Protocol\DFRN;
use Friendica\Protocol\Diaspora; use Friendica\Protocol\Diaspora;
use Friendica\Protocol\Email; use Friendica\Protocol\Email;
use Friendica\Util\Strings; use Friendica\Util\Strings;
use Friendica\Util\Network;
require_once 'include/items.php'; require_once 'include/items.php';
@ -158,6 +159,10 @@ class Delivery extends BaseObject
return; return;
} }
if (Network::isUrlBlocked($contact['url'])) {
return;
}
// Transmit via Diaspora if the thread had started as Diaspora post // 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) // 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)) { if (isset($parent) && ($parent['network'] == Protocol::DIASPORA) && ($contact['network'] == Protocol::DFRN)) {