Skip URL-less mention terms in Object\Post::getDefaultText

- Address https://github.com/friendica/friendica/issues/10167#issuecomment-830859710
- Added logging to troubleshoot deeper issue
This commit is contained in:
Hypolite Petovan 2021-05-10 21:50:42 -04:00
parent 115da7a708
commit 9ef9fc7c14

View File

@ -887,8 +887,13 @@ class Post
$terms = Tag::getByURIId($item['uri-id'], [Tag::MENTION, Tag::IMPLICIT_MENTION, Tag::EXCLUSIVE_MENTION]);
foreach ($terms as $term) {
if (!$term['url']) {
DI::logger()->warning('Mention term with no URL', ['term' => $term]);
continue;
}
$profile = Contact::getByURL($term['url'], false, ['addr', 'contact-type']);
if (!empty($profile['addr']) && ((($profile['contact-type'] ?? '') ?: Contact::TYPE_UNKNOWN) != Contact::TYPE_COMMUNITY) &&
if (!empty($profile['addr']) && (($profile['contact-type'] ?? Contact::TYPE_UNKNOWN) != Contact::TYPE_COMMUNITY) &&
($profile['addr'] != $owner['addr']) && !strstr($text, $profile['addr'])) {
$text .= '@' . $profile['addr'] . ' ';
}