From 060597f6196ce7df4355cce7f1d4c1508ab14200 Mon Sep 17 00:00:00 2001
From: Michael <heluecht@pirati.ca>
Date: Sat, 23 Apr 2022 11:39:19 +0000
Subject: [PATCH 1/5] Store the tag type for the post targets

---
 database.sql                           |  6 ++-
 doc/database/db_tag.md                 | 11 ++--
 src/Model/Tag.php                      | 75 ++++++++++++++++++++++----
 src/Module/PermissionTooltip.php       |  2 +
 src/Protocol/ActivityPub/Processor.php |  5 +-
 static/dbstructure.config.php          |  5 +-
 static/dbview.config.php               |  1 +
 view/lang/C/messages.po                | 15 ++++--
 8 files changed, 96 insertions(+), 24 deletions(-)

diff --git a/database.sql b/database.sql
index 48a75377fe..97d9912bac 100644
--- a/database.sql
+++ b/database.sql
@@ -1,6 +1,6 @@
 -- ------------------------------------------
 -- Friendica 2022.05-dev (Siberian Iris)
--- DB_UPDATE_VERSION 1458
+-- DB_UPDATE_VERSION 1459
 -- ------------------------------------------
 
 
@@ -232,6 +232,7 @@ CREATE TABLE IF NOT EXISTS `tag` (
 	`id` int unsigned NOT NULL auto_increment COMMENT '',
 	`name` varchar(96) NOT NULL DEFAULT '' COMMENT '',
 	`url` varbinary(255) NOT NULL DEFAULT '' COMMENT '',
+	`type` tinyint unsigned COMMENT 'Type of the tag (Unknown, Collection or Account)',
 	 PRIMARY KEY(`id`),
 	 UNIQUE INDEX `type_name_url` (`name`,`url`),
 	 INDEX `url` (`url`)
@@ -2235,7 +2236,8 @@ CREATE VIEW `tag-view` AS SELECT
 	`post-tag`.`tid` AS `tid`,
 	`post-tag`.`cid` AS `cid`,
 	CASE `cid` WHEN 0 THEN `tag`.`name` ELSE `contact`.`name` END AS `name`,
-	CASE `cid` WHEN 0 THEN `tag`.`url` ELSE `contact`.`url` END AS `url`
+	CASE `cid` WHEN 0 THEN `tag`.`url` ELSE `contact`.`url` END AS `url`,
+	CASE `cid` WHEN 0 THEN `tag`.`type` ELSE 1 END AS `tag-type`
 	FROM `post-tag`
 			LEFT JOIN `tag` ON `post-tag`.`tid` = `tag`.`id`
 			LEFT JOIN `contact` ON `post-tag`.`cid` = `contact`.`id`;
diff --git a/doc/database/db_tag.md b/doc/database/db_tag.md
index 8c742917a7..acde7bb265 100644
--- a/doc/database/db_tag.md
+++ b/doc/database/db_tag.md
@@ -6,11 +6,12 @@ tags and mentions
 Fields
 ------
 
-| Field | Description | Type           | Null | Key | Default | Extra          |
-| ----- | ----------- | -------------- | ---- | --- | ------- | -------------- |
-| id    |             | int unsigned   | NO   | PRI | NULL    | auto_increment |
-| name  |             | varchar(96)    | NO   |     |         |                |
-| url   |             | varbinary(255) | NO   |     |         |                |
+| Field | Description                                      | Type             | Null | Key | Default | Extra          |
+| ----- | ------------------------------------------------ | ---------------- | ---- | --- | ------- | -------------- |
+| id    |                                                  | int unsigned     | NO   | PRI | NULL    | auto_increment |
+| name  |                                                  | varchar(96)      | NO   |     |         |                |
+| url   |                                                  | varbinary(255)   | NO   |     |         |                |
+| type  | Type of the tag (Unknown, Collection or Account) | tinyint unsigned | YES  |     | NULL    |                |
 
 Indexes
 ------------
diff --git a/src/Model/Tag.php b/src/Model/Tag.php
index 1cc48bd2f7..b86c5e1cdc 100644
--- a/src/Model/Tag.php
+++ b/src/Model/Tag.php
@@ -29,6 +29,7 @@ use Friendica\Core\System;
 use Friendica\Database\Database;
 use Friendica\Database\DBA;
 use Friendica\DI;
+use Friendica\Protocol\ActivityPub;
 use Friendica\Util\DateTimeFormat;
 use Friendica\Util\Strings;
 
@@ -57,6 +58,9 @@ class Tag
 	const BTO = 12;
 	const BCC = 13;
 
+	const ACCOUNT    = 1;
+	const COLLECTION = 2;
+
 	const TAG_CHARACTER = [
 		self::HASHTAG           => '#',
 		self::MENTION           => '@',
@@ -71,8 +75,9 @@ class Tag
 	 * @param integer $type
 	 * @param string  $name
 	 * @param string  $url
+	 * @param integer $target
 	 */
-	public static function store(int $uriid, int $type, string $name, string $url = '')
+	public static function store(int $uriid, int $type, string $name, string $url = '', int $target = null)
 	{
 		if ($type == self::HASHTAG) {
 			// Trim Unicode non-word characters
@@ -108,11 +113,14 @@ class Tag
 			Logger::debug('Got id for contact', ['cid' => $cid, 'url' => $url]);
 
 			if (empty($cid)) {
-				// The contact wasn't found in the system (most likely some dead account)
-				// We ensure that we only store a single entry by overwriting the previous name
-				Logger::info('URL is not a known contact, updating tag', ['url' => $url, 'name' => $name]);
-				if (!DBA::exists('tag', ['name' => substr($name, 0, 96), 'url' => $url])) {
-					DBA::update('tag', ['name' => substr($name, 0, 96)], ['url' => $url]);
+				$tag = DBA::selectFirst('tag', ['name', 'type'], ['url' => $url]);
+				if (!empty($tag)) {
+					if ($tag['name'] != substr($name, 0, 96)) {
+						DBA::update('tag', ['name' => substr($name, 0, 96)], ['url' => $url]);
+					}
+					if (!empty($target) && ($tag['type'] != $target)) {
+						DBA::update('tag', ['type' => $target], ['url' => $url]);
+					}
 				}
 			}
 		}
@@ -126,7 +134,7 @@ class Tag
 				}
 			}
 
-			$tagid = self::getID($name, $url);
+			$tagid = self::getID($name, $url, $target);
 			if (empty($tagid)) {
 				return;
 			}
@@ -148,17 +156,66 @@ class Tag
 		Logger::info('Stored tag/mention', ['uri-id' => $uriid, 'tag-id' => $tagid, 'contact-id' => $cid, 'name' => $name, 'type' => $type, 'callstack' => System::callstack(8)]);
 	}
 
+	public static function getTargetType(string $url)
+	{
+		if (empty($url)) {
+			return null;
+		}
+
+		$tag = DBA::selectFirst('tag', ['url', 'type'], ['url' => $url]);
+		if (!empty($tag['type'])) {
+			Logger::debug('Found existing type', ['type' => $tag['type'], 'url' => $url]);
+			return $tag['type'];
+		}
+
+		$target = null;
+
+		if ($url == ActivityPub::PUBLIC_COLLECTION) {
+			$target = Tag::COLLECTION;
+			Logger::debug('Public collection', ['url' => $url]);
+		} else {
+			if (DBA::exists('apcontact', ['followers' => $url])) {
+				$target = Tag::COLLECTION;
+				Logger::debug('Found collection via existing apcontact', ['url' => $url]);
+			} elseif (Contact::getIdForURL($url, 0)) {
+				$target = Tag::ACCOUNT;
+				Logger::debug('URL is an account', ['url' => $url]);
+			} else {
+				$content = ActivityPub::fetchContent($url);
+				if (!empty($content['type']) && ($content['type'] == 'OrderedCollection')) {
+					$target = Tag::COLLECTION;
+					Logger::debug('URL is an ordered collection', ['url' => $url]);
+				}
+			}
+		}
+
+		if (!empty($target) && !empty($tag['url']) && empty($tag['type'])) {
+			DBA::update('tag', ['type' => $target], ['url' => $url]);
+		}
+
+		if (empty($target)) {
+			Logger::debug('No type could be detected', ['url' => $url]);
+		}
+
+		return $target;
+	}
+
 	/**
 	 * Get a tag id for a given tag name and url
 	 *
 	 * @param string $name
 	 * @param string $url
+	 * @param int    $type
 	 * @return void
 	 */
-	public static function getID(string $name, string $url = '')
+	public static function getID(string $name, string $url = '', int $type = null)
 	{
 		$fields = ['name' => substr($name, 0, 96), 'url' => $url];
 
+		if (!empty($type)) {
+			$fields['type'] = $type;
+		}
+
 		$tag = DBA::selectFirst('tag', ['id'], $fields);
 		if (DBA::isResult($tag)) {
 			return $tag['id'];
@@ -373,7 +430,7 @@ class Tag
 	public static function getByURIId(int $uri_id, array $type = [self::HASHTAG, self::MENTION, self::EXCLUSIVE_MENTION, self::IMPLICIT_MENTION])
 	{
 		$condition = ['uri-id' => $uri_id, 'type' => $type];
-		return DBA::selectToArray('tag-view', ['type', 'name', 'url'], $condition);
+		return DBA::selectToArray('tag-view', ['type', 'name', 'url', 'tag-type'], $condition);
 	}
 
 	/**
diff --git a/src/Module/PermissionTooltip.php b/src/Module/PermissionTooltip.php
index 58b6df086d..a58465b40e 100644
--- a/src/Module/PermissionTooltip.php
+++ b/src/Module/PermissionTooltip.php
@@ -200,6 +200,8 @@ class PermissionTooltip extends \Friendica\BaseModule
 					$receivers[$receiver['type']][] = DI::l10n()->t('Followers (%s)', $apcontact['name']);
 				} elseif ($apcontact = APContact::getByURL($receiver['url'], false)) {
 					$receivers[$receiver['type']][] = $apcontact['name'];
+				} elseif ($receiver['tag-type'] == Tag::COLLECTION) {
+					$receivers[$receiver['type']][] = DI::l10n()->t('Collection (%s)', $receiver['name']);
 				} else {
 					$receivers[$receiver['type']][] = $receiver['name'];
 				}
diff --git a/src/Protocol/ActivityPub/Processor.php b/src/Protocol/ActivityPub/Processor.php
index be17ea469c..007144265d 100644
--- a/src/Protocol/ActivityPub/Processor.php
+++ b/src/Protocol/ActivityPub/Processor.php
@@ -941,7 +941,10 @@ class Processor
 					} else {
 						$name = trim(parse_url($receiver, PHP_URL_PATH), '/');
 					}
-					Tag::store($uriid, $type, $name, $receiver);
+
+					$target = Tag::getTargetType($receiver);
+					Logger::debug('Got target type', ['type' => $target, 'url' => $receiver]);
+					Tag::store($uriid, $type, $name, $receiver, $target);
 				}
 			}
 		}
diff --git a/static/dbstructure.config.php b/static/dbstructure.config.php
index 8c2f4dcf90..833d7da9ca 100644
--- a/static/dbstructure.config.php
+++ b/static/dbstructure.config.php
@@ -55,7 +55,7 @@
 use Friendica\Database\DBA;
 
 if (!defined('DB_UPDATE_VERSION')) {
-	define('DB_UPDATE_VERSION', 1458);
+	define('DB_UPDATE_VERSION', 1459);
 }
 
 return [
@@ -289,7 +289,8 @@ return [
 		"fields" => [
 			"id" => ["type" => "int unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1", "comment" => ""],
 			"name" => ["type" => "varchar(96)", "not null" => "1", "default" => "", "comment" => ""],
-			"url" => ["type" => "varbinary(255)", "not null" => "1", "default" => "", "comment" => ""]
+			"url" => ["type" => "varbinary(255)", "not null" => "1", "default" => "", "comment" => ""],
+			"type" => ["type" => "tinyint unsigned", "comment" => "Type of the tag (Unknown, Collection or Account)"],
 		],
 		"indexes" => [
 			"PRIMARY" => ["id"],
diff --git a/static/dbview.config.php b/static/dbview.config.php
index 82ccaa9d12..04fc406b43 100644
--- a/static/dbview.config.php
+++ b/static/dbview.config.php
@@ -664,6 +664,7 @@
 			"cid" => ["post-tag", "cid"],
 			"name" => "CASE `cid` WHEN 0 THEN `tag`.`name` ELSE `contact`.`name` END",
 			"url" => "CASE `cid` WHEN 0 THEN `tag`.`url` ELSE `contact`.`url` END",
+			"tag-type" => "CASE `cid` WHEN 0 THEN `tag`.`type` ELSE 1 END",
 		],
 		"query" => "FROM `post-tag`
 			LEFT JOIN `tag` ON `post-tag`.`tid` = `tag`.`id`
diff --git a/view/lang/C/messages.po b/view/lang/C/messages.po
index 8057f6b2e1..2182a7c75b 100644
--- a/view/lang/C/messages.po
+++ b/view/lang/C/messages.po
@@ -8,7 +8,7 @@ msgid ""
 msgstr ""
 "Project-Id-Version: 2022.05-dev\n"
 "Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2022-04-20 20:58+0000\n"
+"POT-Creation-Date: 2022-04-23 08:49+0000\n"
 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
 "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
 "Language-Team: LANGUAGE <LL@li.org>\n"
@@ -8588,22 +8588,27 @@ msgstr ""
 msgid "Followers (%s)"
 msgstr ""
 
-#: src/Module/PermissionTooltip.php:216
+#: src/Module/PermissionTooltip.php:204
+#, php-format
+msgid "Collection (%s)"
+msgstr ""
+
+#: src/Module/PermissionTooltip.php:218
 #, php-format
 msgid "%d more"
 msgstr ""
 
-#: src/Module/PermissionTooltip.php:220
+#: src/Module/PermissionTooltip.php:222
 #, php-format
 msgid "<b>To:</b> %s<br>"
 msgstr ""
 
-#: src/Module/PermissionTooltip.php:223
+#: src/Module/PermissionTooltip.php:225
 #, php-format
 msgid "<b>CC:</b> %s<br>"
 msgstr ""
 
-#: src/Module/PermissionTooltip.php:226
+#: src/Module/PermissionTooltip.php:228
 #, php-format
 msgid "<b>BCC:</b> %s<br>"
 msgstr ""

From 0a3c5cc40cf8f634460457fd87a0619d788cf76b Mon Sep 17 00:00:00 2001
From: Michael <heluecht@pirati.ca>
Date: Sat, 23 Apr 2022 11:43:30 +0000
Subject: [PATCH 2/5] Add the function documentation

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

diff --git a/src/Model/Tag.php b/src/Model/Tag.php
index b86c5e1cdc..da62d611ee 100644
--- a/src/Model/Tag.php
+++ b/src/Model/Tag.php
@@ -156,6 +156,12 @@ class Tag
 		Logger::info('Stored tag/mention', ['uri-id' => $uriid, 'tag-id' => $tagid, 'contact-id' => $cid, 'name' => $name, 'type' => $type, 'callstack' => System::callstack(8)]);
 	}
 
+	/**
+	 * Fetch the target type for the given url
+	 *
+	 * @param string $url 
+	 * @return null|int
+	 */
 	public static function getTargetType(string $url)
 	{
 		if (empty($url)) {

From 4af6e730d3c3d4a88da6ef3a57fe727a8ef6ecec Mon Sep 17 00:00:00 2001
From: Michael <heluecht@pirati.ca>
Date: Sat, 23 Apr 2022 12:32:29 +0000
Subject: [PATCH 3/5] Use different collections

---
 src/Model/Tag.php                | 44 ++++++++++++++++++--------------
 src/Module/PermissionTooltip.php | 35 ++++++++++++++-----------
 2 files changed, 45 insertions(+), 34 deletions(-)

diff --git a/src/Model/Tag.php b/src/Model/Tag.php
index da62d611ee..729ef0dd2b 100644
--- a/src/Model/Tag.php
+++ b/src/Model/Tag.php
@@ -58,8 +58,10 @@ class Tag
 	const BTO = 12;
 	const BCC = 13;
 
-	const ACCOUNT    = 1;
-	const COLLECTION = 2;
+	const ACCOUNT             = 1;
+	const GENERAL_COLLECTION  = 2;
+	const FOLLOWER_COLLECTION = 3;
+	const PUBLIC_COLLECTION   = 4;
 
 	const TAG_CHARACTER = [
 		self::HASHTAG           => '#',
@@ -159,37 +161,41 @@ class Tag
 	/**
 	 * Fetch the target type for the given url
 	 *
-	 * @param string $url 
+	 * @param string $url
+	 * @param bool   $fetch Fetch information via network operations
 	 * @return null|int
 	 */
-	public static function getTargetType(string $url)
+	public static function getTargetType(string $url, bool $fetch = true)
 	{
+		$target = null;
+
 		if (empty($url)) {
-			return null;
+			return $target;
 		}
 
 		$tag = DBA::selectFirst('tag', ['url', 'type'], ['url' => $url]);
 		if (!empty($tag['type'])) {
-			Logger::debug('Found existing type', ['type' => $tag['type'], 'url' => $url]);
-			return $tag['type'];
+			$target = $tag['type'];
+			if ($target != self::GENERAL_COLLECTION) {
+				Logger::debug('Found existing type', ['type' => $tag['type'], 'url' => $url]);
+				return $target;
+			}
 		}
 
-		$target = null;
-
 		if ($url == ActivityPub::PUBLIC_COLLECTION) {
-			$target = Tag::COLLECTION;
+			$target = self::PUBLIC_COLLECTION;
 			Logger::debug('Public collection', ['url' => $url]);
 		} else {
 			if (DBA::exists('apcontact', ['followers' => $url])) {
-				$target = Tag::COLLECTION;
+				$target = self::FOLLOWER_COLLECTION;
 				Logger::debug('Found collection via existing apcontact', ['url' => $url]);
-			} elseif (Contact::getIdForURL($url, 0)) {
-				$target = Tag::ACCOUNT;
+			} elseif (Contact::getIdForURL($url, 0, $fetch ? null : false)) {
+				$target = self::ACCOUNT;
 				Logger::debug('URL is an account', ['url' => $url]);
-			} else {
+			} elseif ($fetch && ($target != self::GENERAL_COLLECTION)) {
 				$content = ActivityPub::fetchContent($url);
 				if (!empty($content['type']) && ($content['type'] == 'OrderedCollection')) {
-					$target = Tag::COLLECTION;
+					$target = self::GENERAL_COLLECTION;
 					Logger::debug('URL is an ordered collection', ['url' => $url]);
 				}
 			}
@@ -258,7 +264,7 @@ class Tag
 
 	/**
 	 * Get tags and mentions from the body
-	 * 
+	 *
 	 * @param string  $body    Body of the post
 	 * @param string  $tags    Accepted tags
 	 *
@@ -279,7 +285,7 @@ class Tag
 
 	/**
 	 * Store tags and mentions from the body
-	 * 
+	 *
 	 * @param integer $uriid   URI-Id
 	 * @param string  $body    Body of the post
 	 * @param string  $tags    Accepted tags
@@ -305,7 +311,7 @@ class Tag
 	 * Store raw tags (not encapsulated in links) from the body
 	 * This function is needed in the intermediate phase.
 	 * Later we can call item::setHashtags in advance to have all tags converted.
-	 * 
+	 *
 	 * @param integer $uriid URI-Id
 	 * @param string  $body   Body of the post
 	 */
@@ -590,7 +596,7 @@ class Tag
 	/**
 	 * Fetch the blocked tags as SQL
 	 *
-	 * @return string 
+	 * @return string
 	 */
 	private static function getBlockedSQL()
 	{
diff --git a/src/Module/PermissionTooltip.php b/src/Module/PermissionTooltip.php
index a58465b40e..ff0bae1bc4 100644
--- a/src/Module/PermissionTooltip.php
+++ b/src/Module/PermissionTooltip.php
@@ -83,15 +83,15 @@ class PermissionTooltip extends \Friendica\BaseModule
 					case Item::PUBLIC:
 						$receivers = DI::l10n()->t('Public');
 						break;
-					
+
 					case Item::UNLISTED:
 						$receivers = DI::l10n()->t('Unlisted');
 						break;
-					
+
 					case Item::PRIVATE:
 						$receivers = DI::l10n()->t('Limited/Private');
 						break;
-				}				
+				}
 			}
 		} else {
 			$receivers = '';
@@ -172,7 +172,7 @@ class PermissionTooltip extends \Friendica\BaseModule
 	 * Fetch a list of receivers
 	 *
 	 * @param int $uriId
-	 * @return string 
+	 * @return string
 	 */
 	private function fetchReceivers(int $uriId):string
 	{
@@ -192,19 +192,24 @@ class PermissionTooltip extends \Friendica\BaseModule
 				continue;
 			}
 
-			if ($receiver['url'] == ActivityPub::PUBLIC_COLLECTION) {
-				$receivers[$receiver['type']][] = DI::l10n()->t('Public');
-			} else {
-				$apcontact = DBA::selectFirst('apcontact', ['name'], ['followers' => $receiver['url']]);
-				if (!empty($apcontact['name'])) {
-					$receivers[$receiver['type']][] = DI::l10n()->t('Followers (%s)', $apcontact['name']);
-				} elseif ($apcontact = APContact::getByURL($receiver['url'], false)) {
-					$receivers[$receiver['type']][] = $apcontact['name'];
-				} elseif ($receiver['tag-type'] == Tag::COLLECTION) {
+			switch (Tag::getTargetType($receiver['url'], false)) {
+				case Tag::PUBLIC_COLLECTION:
+					$receivers[$receiver['type']][] = DI::l10n()->t('Public');
+					break;
+				case Tag::GENERAL_COLLECTION:
 					$receivers[$receiver['type']][] = DI::l10n()->t('Collection (%s)', $receiver['name']);
-				} else {
+					break;
+				case Tag::FOLLOWER_COLLECTION:
+					$apcontact = DBA::selectFirst('apcontact', ['name'], ['followers' => $receiver['url']]);
+					$receivers[$receiver['type']][] = DI::l10n()->t('Followers (%s)', $apcontact['name'] ?? $receiver['name']);
+					break;
+				case Tag::ACCOUNT:
+					$apcontact = APContact::getByURL($receiver['url'], false);
+					$receivers[$receiver['type']][] = $apcontact['name'] ?? $receiver['name'];
+					break;
+				default:
 					$receivers[$receiver['type']][] = $receiver['name'];
-				}
+					break;
 			}
 		}
 

From f7142f0144a286409605b67986dfc2d3f43f01c7 Mon Sep 17 00:00:00 2001
From: Michael <heluecht@pirati.ca>
Date: Sat, 23 Apr 2022 12:45:26 +0000
Subject: [PATCH 4/5] Updated messages.po

---
 view/lang/C/messages.po | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/view/lang/C/messages.po b/view/lang/C/messages.po
index 2182a7c75b..f14e06dc2c 100644
--- a/view/lang/C/messages.po
+++ b/view/lang/C/messages.po
@@ -8,7 +8,7 @@ msgid ""
 msgstr ""
 "Project-Id-Version: 2022.05-dev\n"
 "Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2022-04-23 08:49+0000\n"
+"POT-Creation-Date: 2022-04-23 12:37+0000\n"
 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
 "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
 "Language-Team: LANGUAGE <LL@li.org>\n"
@@ -3315,7 +3315,7 @@ msgid "Post to Email"
 msgstr ""
 
 #: src/Core/ACL.php:320 src/Module/PermissionTooltip.php:84
-#: src/Module/PermissionTooltip.php:196
+#: src/Module/PermissionTooltip.php:197
 msgid "Public"
 msgstr ""
 
@@ -8585,30 +8585,30 @@ msgstr ""
 
 #: src/Module/PermissionTooltip.php:200
 #, php-format
-msgid "Followers (%s)"
+msgid "Collection (%s)"
 msgstr ""
 
 #: src/Module/PermissionTooltip.php:204
 #, php-format
-msgid "Collection (%s)"
+msgid "Followers (%s)"
 msgstr ""
 
-#: src/Module/PermissionTooltip.php:218
+#: src/Module/PermissionTooltip.php:223
 #, php-format
 msgid "%d more"
 msgstr ""
 
-#: src/Module/PermissionTooltip.php:222
+#: src/Module/PermissionTooltip.php:227
 #, php-format
 msgid "<b>To:</b> %s<br>"
 msgstr ""
 
-#: src/Module/PermissionTooltip.php:225
+#: src/Module/PermissionTooltip.php:230
 #, php-format
 msgid "<b>CC:</b> %s<br>"
 msgstr ""
 
-#: src/Module/PermissionTooltip.php:228
+#: src/Module/PermissionTooltip.php:233
 #, php-format
 msgid "<b>BCC:</b> %s<br>"
 msgstr ""

From ac08bc13620f792d539ef3643546df557fb8da30 Mon Sep 17 00:00:00 2001
From: Michael <heluecht@pirati.ca>
Date: Sun, 24 Apr 2022 00:20:06 +0000
Subject: [PATCH 5/5] Enhanced database comment

---
 database.sql                  |  2 +-
 doc/database/db_tag.md        | 12 ++++++------
 static/dbstructure.config.php |  2 +-
 3 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/database.sql b/database.sql
index 97d9912bac..26f948c2d3 100644
--- a/database.sql
+++ b/database.sql
@@ -232,7 +232,7 @@ CREATE TABLE IF NOT EXISTS `tag` (
 	`id` int unsigned NOT NULL auto_increment COMMENT '',
 	`name` varchar(96) NOT NULL DEFAULT '' COMMENT '',
 	`url` varbinary(255) NOT NULL DEFAULT '' COMMENT '',
-	`type` tinyint unsigned COMMENT 'Type of the tag (Unknown, Collection or Account)',
+	`type` tinyint unsigned COMMENT 'Type of the tag (Unknown, General Collection, Follower Collection or Account)',
 	 PRIMARY KEY(`id`),
 	 UNIQUE INDEX `type_name_url` (`name`,`url`),
 	 INDEX `url` (`url`)
diff --git a/doc/database/db_tag.md b/doc/database/db_tag.md
index acde7bb265..5716398012 100644
--- a/doc/database/db_tag.md
+++ b/doc/database/db_tag.md
@@ -6,12 +6,12 @@ tags and mentions
 Fields
 ------
 
-| Field | Description                                      | Type             | Null | Key | Default | Extra          |
-| ----- | ------------------------------------------------ | ---------------- | ---- | --- | ------- | -------------- |
-| id    |                                                  | int unsigned     | NO   | PRI | NULL    | auto_increment |
-| name  |                                                  | varchar(96)      | NO   |     |         |                |
-| url   |                                                  | varbinary(255)   | NO   |     |         |                |
-| type  | Type of the tag (Unknown, Collection or Account) | tinyint unsigned | YES  |     | NULL    |                |
+| Field | Description                                                                   | Type             | Null | Key | Default | Extra          |
+| ----- | ----------------------------------------------------------------------------- | ---------------- | ---- | --- | ------- | -------------- |
+| id    |                                                                               | int unsigned     | NO   | PRI | NULL    | auto_increment |
+| name  |                                                                               | varchar(96)      | NO   |     |         |                |
+| url   |                                                                               | varbinary(255)   | NO   |     |         |                |
+| type  | Type of the tag (Unknown, General Collection, Follower Collection or Account) | tinyint unsigned | YES  |     | NULL    |                |
 
 Indexes
 ------------
diff --git a/static/dbstructure.config.php b/static/dbstructure.config.php
index 833d7da9ca..f49b38cb55 100644
--- a/static/dbstructure.config.php
+++ b/static/dbstructure.config.php
@@ -290,7 +290,7 @@ return [
 			"id" => ["type" => "int unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1", "comment" => ""],
 			"name" => ["type" => "varchar(96)", "not null" => "1", "default" => "", "comment" => ""],
 			"url" => ["type" => "varbinary(255)", "not null" => "1", "default" => "", "comment" => ""],
-			"type" => ["type" => "tinyint unsigned", "comment" => "Type of the tag (Unknown, Collection or Account)"],
+			"type" => ["type" => "tinyint unsigned", "comment" => "Type of the tag (Unknown, General Collection, Follower Collection or Account)"],
 		],
 		"indexes" => [
 			"PRIMARY" => ["id"],