Fixes empty feed preview data

This commit is contained in:
Michael 2020-09-17 10:36:33 +00:00
parent 953ba74248
commit fbc1cd2528

View file

@ -533,6 +533,9 @@ class Feed
$replace = true;
}
$saved_body = $item["body"];
$saved_title = $item["title"];
if ($replace) {
$item["body"] = trim($item["title"]);
}
@ -549,9 +552,17 @@ class Feed
}
}
$data = PageInfo::queryUrl($item["plink"], false, $preview, ($contact["fetch_further_information"] == 2), $contact["ffi_keyword_denylist"] ?? '');
// Take the data that was provided by the feed if the query wasn't empty
if (($data['type'] == 'link') && empty($data['title']) && empty($data['text'])) {
$data['title'] = $saved_title;
$item["body"] = $saved_body;
}
// We always strip the title since it will be added in the page information
$item["title"] = "";
$item["body"] = $item["body"] . "\n" . PageInfo::getFooterFromUrl($item["plink"], false, $preview, ($contact["fetch_further_information"] == 2), $contact["ffi_keyword_denylist"] ?? '');
$item["body"] = $item["body"] . "\n" . PageInfo::getFooterFromData($data, false);
$taglist = $contact["fetch_further_information"] == 2 ? PageInfo::getTagsFromUrl($item["plink"], $preview, $contact["ffi_keyword_denylist"] ?? '') : [];
$item["object-type"] = Activity\ObjectType::BOOKMARK;
unset($item["attach"]);