Normalize the mentions and ensure to not have duplicates
This commit is contained in:
parent
d4f6261b81
commit
fcfd04bcc9
1 changed files with 15 additions and 1 deletions
|
@ -130,12 +130,26 @@ class Term
|
|||
$term = substr($tag, 1);
|
||||
} elseif (substr(trim($tag), 0, 1) == '@') {
|
||||
$type = TERM_MENTION;
|
||||
|
||||
$contact = Contact::getDetailsByURL($link, 0);
|
||||
if (!empty($contact['name'])) {
|
||||
$term = $contact['name'];
|
||||
} else {
|
||||
$term = substr($tag, 1);
|
||||
}
|
||||
|
||||
if (!empty($contact['url'])) {
|
||||
$link = $contact['url'];
|
||||
}
|
||||
} else { // This shouldn't happen
|
||||
$type = TERM_HASHTAG;
|
||||
$term = $tag;
|
||||
}
|
||||
|
||||
if (DBA::exists('term', ['uid' => $message['uid'], 'otype' => TERM_OBJ_POST, 'oid' => $itemid, 'url' => $link])) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if ($message['uid'] == 0) {
|
||||
$global = true;
|
||||
DBA::update('term', ['global' => true], ['otype' => TERM_OBJ_POST, 'guid' => $message['guid']]);
|
||||
|
|
Loading…
Reference in a new issue