Merge pull request #13012 from annando/html-media-only-selected

Fix: Only add link preview for selected networks
This commit is contained in:
Hypolite Petovan 2023-04-18 14:18:25 -04:00 committed by GitHub
commit 7a55052ad2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -635,7 +635,7 @@ class Media
foreach ($matches[1] as $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);
if ($result && ($network == Protocol::DFRN)) {
if ($result && !in_array($network, [Protocol::ACTIVITYPUB, Protocol::OSTATUS, Protocol::DIASPORA])) {
self::revertHTMLType($uriid, $url, $fullbody);
Logger::debug('Revert HTML type', ['uri-id' => $uriid, 'url' => $url]);
} elseif ($result) {
@ -651,7 +651,7 @@ class Media
foreach ($matches[1] as $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);
if ($result && ($network == Protocol::DFRN)) {
if ($result && !in_array($network, [Protocol::ACTIVITYPUB, Protocol::OSTATUS, Protocol::DIASPORA])) {
self::revertHTMLType($uriid, $url, $fullbody);
Logger::debug('Revert HTML type', ['uri-id' => $uriid, 'url' => $url]);
} elseif ($result) {