Fix: Only add link preview for selected networks

This commit is contained in:
Michael 2023-04-18 17:56:30 +00:00
parent 815c1f4e33
commit 2ad8bd901a

View File

@ -635,7 +635,7 @@ class Media
foreach ($matches[1] as $url) { foreach ($matches[1] as $url) {
Logger::info('Got page url (link without description)', ['uri-id' => $uriid, 'url' => $url]); Logger::info('Got page url (link without description)', ['uri-id' => $uriid, 'url' => $url]);
$result = self::insert(['uri-id' => $uriid, 'type' => self::UNKNOWN, 'url' => $url], false, $network); $result = self::insert(['uri-id' => $uriid, 'type' => self::UNKNOWN, 'url' => $url], false, $network);
if ($result && ($network == Protocol::DFRN)) { if ($result && !in_array($network, [Protocol::ACTIVITYPUB, Protocol::OSTATUS, Protocol::DIASPORA])) {
self::revertHTMLType($uriid, $url, $fullbody); self::revertHTMLType($uriid, $url, $fullbody);
Logger::debug('Revert HTML type', ['uri-id' => $uriid, 'url' => $url]); Logger::debug('Revert HTML type', ['uri-id' => $uriid, 'url' => $url]);
} elseif ($result) { } elseif ($result) {
@ -651,7 +651,7 @@ class Media
foreach ($matches[1] as $url) { foreach ($matches[1] as $url) {
Logger::info('Got page url (link with description)', ['uri-id' => $uriid, 'url' => $url]); Logger::info('Got page url (link with description)', ['uri-id' => $uriid, 'url' => $url]);
$result = self::insert(['uri-id' => $uriid, 'type' => self::UNKNOWN, 'url' => $url], false, $network); $result = self::insert(['uri-id' => $uriid, 'type' => self::UNKNOWN, 'url' => $url], false, $network);
if ($result && ($network == Protocol::DFRN)) { if ($result && !in_array($network, [Protocol::ACTIVITYPUB, Protocol::OSTATUS, Protocol::DIASPORA])) {
self::revertHTMLType($uriid, $url, $fullbody); self::revertHTMLType($uriid, $url, $fullbody);
Logger::debug('Revert HTML type', ['uri-id' => $uriid, 'url' => $url]); Logger::debug('Revert HTML type', ['uri-id' => $uriid, 'url' => $url]);
} elseif ($result) { } elseif ($result) {