From 0c026be2c1fdbd87573d0c1fa398a9c115fec8f9 Mon Sep 17 00:00:00 2001 From: nobody Date: Fri, 11 Sep 2020 02:12:09 -0700 Subject: [PATCH 1/5] allow forum delivery using attached mention tags (as well as mentions in the body) --- src/Model/Item.php | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/Model/Item.php b/src/Model/Item.php index 724f61e25..d18e96aa1 100644 --- a/src/Model/Item.php +++ b/src/Model/Item.php @@ -29,6 +29,7 @@ use Friendica\Core\Protocol; use Friendica\Core\Renderer; use Friendica\Core\Session; use Friendica\Core\System; +use Friendica\Core\Tag; use Friendica\Core\Worker; use Friendica\Database\DBA; use Friendica\Database\DBStructure; @@ -2670,6 +2671,16 @@ class Item } } + if (!$mention) { + $tags = Tag::getByURIId($item_id, [Tag::MENTION, Tag::EXCLUSIVE_MENTION]); + $foreach ($tags as $tag) { + if (Strings::compareLink($link, $tag['url']) || Strings::compareLink($dlink, $tag['url'])) { + $mention = true; + Logger::log('mention found in tag: ' . $tag['url']); + } + } + } + if (!$mention) { if (($community_page || $prvgroup) && !$item['wall'] && !$item['origin'] && ($item['gravity'] == GRAVITY_PARENT)) { From 61685aeadd50a26b89602e127641fdda026136a2 Mon Sep 17 00:00:00 2001 From: nobody Date: Fri, 11 Sep 2020 02:29:13 -0700 Subject: [PATCH 2/5] function name --- src/Model/Item.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Model/Item.php b/src/Model/Item.php index d18e96aa1..16ac27265 100644 --- a/src/Model/Item.php +++ b/src/Model/Item.php @@ -2673,7 +2673,7 @@ class Item if (!$mention) { $tags = Tag::getByURIId($item_id, [Tag::MENTION, Tag::EXCLUSIVE_MENTION]); - $foreach ($tags as $tag) { + foreach ($tags as $tag) { if (Strings::compareLink($link, $tag['url']) || Strings::compareLink($dlink, $tag['url'])) { $mention = true; Logger::log('mention found in tag: ' . $tag['url']); From d3cb72c33c212d615bd9e0af9e95c5f0fe010056 Mon Sep 17 00:00:00 2001 From: nobody Date: Fri, 11 Sep 2020 02:37:18 -0700 Subject: [PATCH 3/5] see what namespace works --- src/Model/Item.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Model/Item.php b/src/Model/Item.php index 16ac27265..fb780845a 100644 --- a/src/Model/Item.php +++ b/src/Model/Item.php @@ -29,7 +29,7 @@ use Friendica\Core\Protocol; use Friendica\Core\Renderer; use Friendica\Core\Session; use Friendica\Core\System; -use Friendica\Core\Tag; +use Friendica\Model\Tag; use Friendica\Core\Worker; use Friendica\Database\DBA; use Friendica\Database\DBStructure; From 5041aab89e9f1c23d5cd65ac4b5cca5004c60e68 Mon Sep 17 00:00:00 2001 From: Hypolite Petovan Date: Fri, 11 Sep 2020 08:06:30 -0400 Subject: [PATCH 4/5] Use DI logger in src/Model/Item.php Co-authored-by: Philipp --- src/Model/Item.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Model/Item.php b/src/Model/Item.php index fb780845a..7d379f1b4 100644 --- a/src/Model/Item.php +++ b/src/Model/Item.php @@ -2676,7 +2676,7 @@ class Item foreach ($tags as $tag) { if (Strings::compareLink($link, $tag['url']) || Strings::compareLink($dlink, $tag['url'])) { $mention = true; - Logger::log('mention found in tag: ' . $tag['url']); + DI::logger()->info('mention found in tag.', ['url' => $tag['url']]); } } } From 35b98ce97f1e4ac9157be53056da09070340938a Mon Sep 17 00:00:00 2001 From: Hypolite Petovan Date: Sat, 12 Sep 2020 11:43:02 -0400 Subject: [PATCH 5/5] Use item uri-id in src/Model/Item.php --- src/Model/Item.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Model/Item.php b/src/Model/Item.php index 7d379f1b4..371331730 100644 --- a/src/Model/Item.php +++ b/src/Model/Item.php @@ -2672,7 +2672,7 @@ class Item } if (!$mention) { - $tags = Tag::getByURIId($item_id, [Tag::MENTION, Tag::EXCLUSIVE_MENTION]); + $tags = Tag::getByURIId($item['uri-id'], [Tag::MENTION, Tag::EXCLUSIVE_MENTION]); foreach ($tags as $tag) { if (Strings::compareLink($link, $tag['url']) || Strings::compareLink($dlink, $tag['url'])) { $mention = true;