Merge pull request #6678 from rabuzarus/20190217_-_fix_magicLinks_mentions

fix magic links for item mentions
2022.09-rc
Hypolite Petovan 2019-02-17 21:24:01 -05:00 zatwierdzone przez GitHub
commit 74edf9994f
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 4AEE18F83AFDEB23
1 zmienionych plików z 2 dodań i 1 usunięć

Wyświetl plik

@ -272,10 +272,10 @@ class Term
$author = ['uid' => 0, 'id' => $item['author-id'], $author = ['uid' => 0, 'id' => $item['author-id'],
'network' => $item['author-network'], 'url' => $item['author-link']]; 'network' => $item['author-network'], 'url' => $item['author-link']];
$tag['url'] = Contact::magicLinkByContact($author, $tag['url']);
$prefix = ''; $prefix = '';
if ($tag['type'] == TERM_HASHTAG) { if ($tag['type'] == TERM_HASHTAG) {
$tag['url'] = Contact::magicLinkByContact($author, $tag['url']);
if ($orig_tag != $tag['url']) { if ($orig_tag != $tag['url']) {
$item['body'] = str_replace($orig_tag, $tag['url'], $item['body']); $item['body'] = str_replace($orig_tag, $tag['url'], $item['body']);
} }
@ -283,6 +283,7 @@ class Term
$return['hashtags'][] = '#<a href="' . $tag['url'] . '" target="_blank">' . $tag['term'] . '</a>'; $return['hashtags'][] = '#<a href="' . $tag['url'] . '" target="_blank">' . $tag['term'] . '</a>';
$prefix = '#'; $prefix = '#';
} elseif ($tag['type'] == TERM_MENTION) { } elseif ($tag['type'] == TERM_MENTION) {
$tag['url'] = Contact::magicLink($tag['url']);
$return['mentions'][] = '@<a href="' . $tag['url'] . '" target="_blank">' . $tag['term'] . '</a>'; $return['mentions'][] = '@<a href="' . $tag['url'] . '" target="_blank">' . $tag['term'] . '</a>';
$prefix = '@'; $prefix = '@';
} }