From 75977ee72b1f014ac6601a406ff394c66eb48f53 Mon Sep 17 00:00:00 2001
From: Hypolite Petovan <hypolite@mrpetovan.com>
Date: Wed, 13 May 2020 22:35:13 -0400
Subject: [PATCH 1/2] Remove remaining references to cirtual field item.tag

---
 mod/photos.php             |  5 ++---
 src/Module/Debug/Babel.php | 10 +++++-----
 2 files changed, 7 insertions(+), 8 deletions(-)

diff --git a/mod/photos.php b/mod/photos.php
index 311d2b1c14..7a647e06b9 100644
--- a/mod/photos.php
+++ b/mod/photos.php
@@ -509,9 +509,9 @@ function photos_post(App $a)
 
 						if ($profile) {
 							if (!empty($contact)) {
-								$taginfo[] = [$newname, $profile, $notify, $contact, '@[url=' . str_replace(',', '%2c', $profile) . ']' . $newname . '[/url]'];
+								$taginfo[] = [$newname, $profile, $notify, $contact];
 							} else {
-								$taginfo[] = [$newname, $profile, $notify, null, '@[url=' . $profile . ']' . $newname . '[/url]'];
+								$taginfo[] = [$newname, $profile, $notify, null];
 							}
 
 							$profile = str_replace(',', '%2c', $profile);
@@ -579,7 +579,6 @@ function photos_post(App $a)
 					$arr['gravity']       = GRAVITY_PARENT;
 					$arr['object-type']   = Activity\ObjectType::PERSON;
 					$arr['target-type']   = Activity\ObjectType::IMAGE;
-					$arr['tag']           = $tagged[4];
 					$arr['inform']        = $tagged[2];
 					$arr['origin']        = 1;
 					$arr['body']          = DI::l10n()->t('%1$s was tagged in %2$s by %3$s', '[url=' . $tagged[1] . ']' . $tagged[0] . '[/url]', '[url=' . DI::baseUrl() . '/photos/' . $owner_record['nickname'] . '/image/' . $photo['resource-id'] . ']' . DI::l10n()->t('a photo') . '[/url]', '[url=' . $owner_record['url'] . ']' . $owner_record['name'] . '[/url]') ;
diff --git a/src/Module/Debug/Babel.php b/src/Module/Debug/Babel.php
index 80c70f7888..ecad73f4dc 100644
--- a/src/Module/Debug/Babel.php
+++ b/src/Module/Debug/Babel.php
@@ -26,6 +26,7 @@ use Friendica\Content\Text;
 use Friendica\Core\Renderer;
 use Friendica\DI;
 use Friendica\Model\Item;
+use Friendica\Model\Tag;
 use Friendica\Util\XML;
 
 /**
@@ -101,10 +102,9 @@ class Babel extends BaseModule
 						'content' => visible_whitespace($bbcode4)
 					];
 
-					$item = [
-						'body' => $bbcode,
-						'tag'  => '',
-					];
+					$item = ['body' => $bbcode];
+
+					$tags = Text\BBCode::getTags($bbcode);
 
 					Item::setHashtags($item);
 					$results[] = [
@@ -113,7 +113,7 @@ class Babel extends BaseModule
 					];
 					$results[] = [
 						'title'   => DI::l10n()->t('Item Tags'),
-						'content' => $item['tag']
+						'content' => visible_whitespace(var_export($tags, true)),
 					];
 					break;
 				case 'diaspora':

From c2a76db2900d44baa6f91e066c9c34cdb54c9456 Mon Sep 17 00:00:00 2001
From: Hypolite Petovan <hypolite@mrpetovan.com>
Date: Wed, 13 May 2020 22:35:39 -0400
Subject: [PATCH 2/2] Add type filter parameter to Tag::getCSVByURIId

---
 src/Model/Tag.php | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/src/Model/Tag.php b/src/Model/Tag.php
index 2f38608ccb..87383fbbca 100644
--- a/src/Model/Tag.php
+++ b/src/Model/Tag.php
@@ -366,12 +366,14 @@ class Tag
 	 * Return a string with all tags and mentions
 	 *
 	 * @param integer $uri_id
+	 * @param array   $type
 	 * @return string tags and mentions
+	 * @throws \Exception
 	 */
-	public static function getCSVByURIId(int $uri_id)
+	public static function getCSVByURIId(int $uri_id, array $type = [self::HASHTAG, self::MENTION, self::IMPLICIT_MENTION, self::EXCLUSIVE_MENTION])
 	{
 		$tag_list = [];
-		$tags = self::getByURIId($uri_id);
+		$tags = self::getByURIId($uri_id, $type);
 		foreach ($tags as $tag) {
 			$tag_list[] = self::TAG_CHARACTER[$tag['type']] . '[url=' . $tag['url'] . ']' . $tag['name'] . '[/url]';
 		}