Remove 'blocklist' pconfig functionality (#13780)
authorMichael Vogel <icarus@dabo.de>
Fri, 29 Dec 2023 23:51:41 +0000 (00:51 +0100)
committerGitHub <noreply@github.com>
Fri, 29 Dec 2023 23:51:41 +0000 (00:51 +0100)
* Cache blocklist

* Remove 'blocklist' pconfig functionality

* The blocklist variable isn't used anymore

src/Content/Conversation.php

index deecc6c..303850d 100644 (file)
@@ -658,10 +658,6 @@ class Conversation
                        * But for now, this array respects the old style, just in case
                        */
                        foreach ($items as $item) {
-                               if (in_array($item['author-id'], $this->getBlocklist())) {
-                                       continue;
-                               }
-
                                // Can we put this after the visibility check?
                                $this->builtinActivityPuller($item, $conv_responses);
 
@@ -696,33 +692,6 @@ class Conversation
                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.
         *
@@ -1280,16 +1249,10 @@ class Conversation
                        return $parents;
                }
 
-               $blocklist = $this->getBlocklist();
-
                $item_array = [];
 
                // Dedupes the item list on the uri to prevent infinite loops
                foreach ($item_list as $item) {
-                       if (in_array($item['author-id'], $blocklist)) {
-                               continue;
-                       }
-
                        $item_array[$item['uri-id']] = $item;
                }
 
@@ -1478,10 +1441,6 @@ class Conversation
                                continue;
                        }
 
-                       if (in_array($item['author-id'], $this->getBlocklist())) {
-                               continue;
-                       }
-
                        // prevent private email from leaking.
                        if ($item['network'] === Protocol::MAIL && $this->session->getLocalUserId() != $item['uid']) {
                                continue;