Improve the code
authorMichael <heluecht@pirati.ca>
Sat, 10 Apr 2021 21:33:18 +0000 (21:33 +0000)
committerMichael <heluecht@pirati.ca>
Sat, 10 Apr 2021 21:33:18 +0000 (21:33 +0000)
src/Protocol/ActivityPub/Transmitter.php

index 3a6cf56..2c1276c 100644 (file)
@@ -1346,7 +1346,7 @@ class Transmitter
                        return '';
                }
 
-               $data = Contact::getByURL($match[1], false, ['addr', 'nick']);
+               $data = Contact::getByURL($match[1], false, ['addr']);
                if (empty($data['addr'])) {
                        return $match[0];
                }
@@ -1517,7 +1517,7 @@ class Transmitter
                        $body = $item['raw-body'] ?? self::removePictures($body);
                } elseif (($type == 'Article') && empty($data['summary'])) {
                        $regexp = "/[@!]\[url\=([^\[\]]*)\].*?\[\/url\]/ism";
-                       $summary = preg_replace_callback($regexp, ['\Friendica\Protocol\ActivityPub\Transmitter', 'mentionAddrCallback'], $body);
+                       $summary = preg_replace_callback($regexp, ['self', 'mentionAddrCallback'], $body);
                        $data['summary'] = BBCode::toPlaintext(Plaintext::shorten(self::removePictures($summary), 1000));
                }