Merge pull request #10150 from annando/no-photo

Quickfix to avoid bad looking incoming tweets
This commit is contained in:
Tobias Diekershoff 2021-04-17 18:16:17 +02:00 committed by GitHub
commit a6eeb7af11
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 4 deletions

View file

@ -2684,7 +2684,8 @@ class Item
{ {
$leading = ''; $leading = '';
$trailing = ''; $trailing = '';
foreach (Post\Media::getByURIId($item['uri-id'], [Post\Media::AUDIO, Post\Media::VIDEO, // currently deactivated the request for Post\Media::VIDEO since it creates mutliple videos from Peertube
foreach (Post\Media::getByURIId($item['uri-id'], [Post\Media::AUDIO,
Post\Media::DOCUMENT, Post\Media::TORRENT, Post\Media::UNKNOWN]) as $attachment) { Post\Media::DOCUMENT, Post\Media::TORRENT, Post\Media::UNKNOWN]) as $attachment) {
if (in_array($attachment['type'], [Post\Media::AUDIO, Post\Media::VIDEO]) && strpos($item['body'], $attachment['url'])) { if (in_array($attachment['type'], [Post\Media::AUDIO, Post\Media::VIDEO]) && strpos($item['body'], $attachment['url'])) {
continue; continue;

View file

@ -477,10 +477,11 @@ class ParseUrl
} }
} }
// Currently deactivated, see https://github.com/friendica/friendica/pull/10148#issuecomment-821512658
// Prevent to have a photo type without an image // Prevent to have a photo type without an image
if ($twitter_card && $twitter_image && !empty($siteinfo['image'])) { // if ($twitter_card && $twitter_image && !empty($siteinfo['image'])) {
$siteinfo['type'] = 'photo'; // $siteinfo['type'] = 'photo';
} // }
if (!empty($siteinfo['image'])) { if (!empty($siteinfo['image'])) {
$siteinfo['images'] = $siteinfo['images'] ?? []; $siteinfo['images'] = $siteinfo['images'] ?? [];