Remove 'blocklist' pconfig functionality (#13780)

* Cache blocklist

* Remove 'blocklist' pconfig functionality

* The blocklist variable isn't used anymore
This commit is contained in:
Michael Vogel 2023-12-30 00:51:41 +01:00 committed by GitHub
parent ad1389b20a
commit 0c68a53e1e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -658,10 +658,6 @@ class Conversation
* But for now, this array respects the old style, just in case * But for now, this array respects the old style, just in case
*/ */
foreach ($items as $item) { foreach ($items as $item) {
if (in_array($item['author-id'], $this->getBlocklist())) {
continue;
}
// Can we put this after the visibility check? // Can we put this after the visibility check?
$this->builtinActivityPuller($item, $conv_responses); $this->builtinActivityPuller($item, $conv_responses);
@ -696,33 +692,6 @@ class Conversation
return $threads; return $threads;
} }
private function getBlocklist(): array
{
if (!$this->session->getLocalUserId()) {
return [];
}
if (!empty($this->blockList)) {
return $this->blockList;
}
$str_blocked = str_replace(["\n", "\r"], ",", $this->pConfig->get($this->session->getLocalUserId(), 'system', 'blocked') ?? '');
if (empty($str_blocked)) {
return [];
}
$this->blockList = [];
foreach (explode(',', $str_blocked) as $entry) {
$cid = Contact::getIdForURL(trim($entry), 0, false);
if (!empty($cid)) {
$this->blockList[] = $cid;
}
}
return $this->blockList;
}
/** /**
* Adds some information (Causer, post reason, direction) to the fetched post row. * Adds some information (Causer, post reason, direction) to the fetched post row.
* *
@ -1280,16 +1249,10 @@ class Conversation
return $parents; return $parents;
} }
$blocklist = $this->getBlocklist();
$item_array = []; $item_array = [];
// Dedupes the item list on the uri to prevent infinite loops // Dedupes the item list on the uri to prevent infinite loops
foreach ($item_list as $item) { foreach ($item_list as $item) {
if (in_array($item['author-id'], $blocklist)) {
continue;
}
$item_array[$item['uri-id']] = $item; $item_array[$item['uri-id']] = $item;
} }
@ -1478,10 +1441,6 @@ class Conversation
continue; continue;
} }
if (in_array($item['author-id'], $this->getBlocklist())) {
continue;
}
// prevent private email from leaking. // prevent private email from leaking.
if ($item['network'] === Protocol::MAIL && $this->session->getLocalUserId() != $item['uid']) { if ($item['network'] === Protocol::MAIL && $this->session->getLocalUserId() != $item['uid']) {
continue; continue;