$tags = BBCode::getTags($body);
- if ($thread_parent_uriid && !\Friendica\Content\Feature::isEnabled($uid, 'explicit_mentions')) {
- $tags = item_add_implicit_mentions($tags, $thread_parent_contact, $thread_parent_uriid);
- }
-
$tagged = [];
$private_forum = false;
}
Tag::storeFromBody($datarray['uri-id'], $datarray['body']);
- Tag::createImplicitMentions($datarray['uri-id'], $datarray['thr-parent-id']);
+
+ if (!\Friendica\Content\Feature::isEnabled($uid, 'explicit_mentions')) {
+ Tag::createImplicitMentions($datarray['uri-id'], $datarray['thr-parent-id']);
+ }
// update filetags in pconfig
FileTag::updatePconfig($uid, $categories_old, $categories_new, 'category');
return ['replaced' => $replaced, 'contact' => $contact];
}
-
-function item_add_implicit_mentions(array $tags, array $thread_parent_contact, $thread_parent_uriid)
-{
- if (!DI::config()->get('system', 'disable_implicit_mentions')) {
- return $tags;
- }
-
- // Add a tag if the parent contact is from ActivityPub or OStatus (This will notify them)
- if (in_array($thread_parent_contact['network'], [Protocol::OSTATUS, Protocol::ACTIVITYPUB])) {
- $contact = Tag::TAG_CHARACTER[Tag::MENTION] . '[url=' . $thread_parent_contact['url'] . ']' . $thread_parent_contact['nick'] . '[/url]';
- if (!stripos(implode($tags), '[url=' . $thread_parent_contact['url'] . ']')) {
- $tags[] = $contact;
- }
- }
-
- return $tags;
-}
*/
public static function createImplicitMentions(int $uri_id, int $parent_uri_id)
{
+ // Always mention the direct parent author
+ $parent = Item::selectFirst(['author-link', 'author-name'], ['uri-id' => $parent_uri_id]);
+ self::store($uri_id, self::IMPLICIT_MENTION, $parent['author-name'], $parent['author-link']);
+
if (DI::config()->get('system', 'disable_implicit_mentions')) {
return;
}
while ($tag = DBA::fetch($tags)) {
self::store($uri_id, self::IMPLICIT_MENTION, $tag['name'], $tag['url']);
}
-
- $parent = Item::selectFirst(['author-link', 'author-name'], ['uri-id' => $parent_uri_id]);
- self::store($uri_id, self::IMPLICIT_MENTION, $parent['author-name'], $parent['author-link']);
}
/**