AP contacts are now tagged upon commenting

This commit is contained in:
Michael 2018-10-01 21:09:08 +00:00
parent 6020605d5c
commit 7e9499ac13

View file

@ -343,23 +343,14 @@ function item_post(App $a) {
$tags = get_tags($body); $tags = get_tags($body);
// Add a tag if the parent contact is from OStatus (This will notify them during delivery) // Add a tag if the parent contact is from ActivityPub or OStatus (This will notify them)
if ($parent) { if ($parent && in_array($thr_parent_contact['network'], [Protocol::OSTATUS, Protocol::ACTIVITYPUB])) {
if ($thr_parent_contact['network'] == Protocol::OSTATUS) {
$contact = '@[url=' . $thr_parent_contact['url'] . ']' . $thr_parent_contact['nick'] . '[/url]'; $contact = '@[url=' . $thr_parent_contact['url'] . ']' . $thr_parent_contact['nick'] . '[/url]';
if (!stripos(implode($tags), '[url=' . $thr_parent_contact['url'] . ']')) { if (!stripos(implode($tags), '[url=' . $thr_parent_contact['url'] . ']')) {
$tags[] = $contact; $tags[] = $contact;
} }
} }
if ($parent_contact['network'] == Protocol::OSTATUS) {
$contact = '@[url=' . $parent_contact['url'] . ']' . $parent_contact['nick'] . '[/url]';
if (!stripos(implode($tags), '[url=' . $parent_contact['url'] . ']')) {
$tags[] = $contact;
}
}
}
$tagged = []; $tagged = [];
$private_forum = false; $private_forum = false;
@ -1026,8 +1017,7 @@ function handle_tag(App $a, &$body, &$inform, &$str_tags, $profile_uid, $tag, $n
$alias = $contact["alias"]; $alias = $contact["alias"];
$newname = $contact["nick"]; $newname = $contact["nick"];
if (($newname == "") || (($contact["network"] != Protocol::OSTATUS) && ($contact["network"] != Protocol::TWITTER) if (($newname == "") || !in_array($contact["network"], [Protocol::ACTIVITYPUB, Protocol::OSTATUS, Protocol::TWITTER, Protocol::STATUSNET])) {
&& ($contact["network"] != Protocol::STATUSNET))) {
$newname = $contact["name"]; $newname = $contact["name"];
} }
} }