From 59630a2c821cda6ac3a5ced81f2fb8831f8755f4 Mon Sep 17 00:00:00 2001 From: Michael Date: Wed, 23 Feb 2022 20:18:37 +0000 Subject: [PATCH] Improve the name of the "followers" receiver --- src/Module/PermissionTooltip.php | 12 ++++++++++- src/Protocol/ActivityPub/Receiver.php | 2 +- view/lang/C/messages.po | 31 ++++++++++++++++----------- 3 files changed, 30 insertions(+), 15 deletions(-) diff --git a/src/Module/PermissionTooltip.php b/src/Module/PermissionTooltip.php index f6722c984a..372c508d6f 100644 --- a/src/Module/PermissionTooltip.php +++ b/src/Module/PermissionTooltip.php @@ -28,6 +28,7 @@ use Friendica\Model\Group; use Friendica\Model\Post; use Friendica\Model\Tag; use Friendica\Network\HTTPException; +use Friendica\Protocol\ActivityPub; /** * Outputs the permission tooltip HTML content for the provided item, photo or event id. @@ -161,7 +162,16 @@ class PermissionTooltip extends \Friendica\BaseModule // We only fetch "to" and "cc", because "bcc" should never be displayed $receivers = []; foreach (Tag::getByURIId($uriId, [Tag::TO, Tag::CC]) as $receiver) { - $receivers[$receiver['type']][] = $receiver['name']; + 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']); + } else { + $receivers[$receiver['type']][] = $receiver['name']; + } + } } $output = ''; diff --git a/src/Protocol/ActivityPub/Receiver.php b/src/Protocol/ActivityPub/Receiver.php index e82745b755..32994a9d5d 100644 --- a/src/Protocol/ActivityPub/Receiver.php +++ b/src/Protocol/ActivityPub/Receiver.php @@ -415,7 +415,7 @@ class Receiver } foreach (['as:to', 'as:cc', 'as:bto', 'as:bcc'] as $element) { - if (!empty($urls[$element])) { + if ((empty($object_data['receiver_urls'][$element]) || in_array($element, ['as:bto', 'as:bcc'])) && !empty($urls[$element])) { $object_data['receiver_urls'][$element] = array_unique(array_merge($object_data['receiver_urls'][$element] ?? [], $urls[$element])); } } diff --git a/view/lang/C/messages.po b/view/lang/C/messages.po index 93b3f3731e..ea72ffd87e 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-02-20 20:50+0000\n" +"POT-Creation-Date: 2022-02-23 20:09+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -2157,8 +2157,8 @@ msgid "All contacts" msgstr "" #: src/BaseModule.php:409 src/Content/Widget.php:231 src/Core/ACL.php:193 -#: src/Module/Contact.php:367 src/Module/PermissionTooltip.php:103 -#: src/Module/PermissionTooltip.php:125 +#: src/Module/Contact.php:367 src/Module/PermissionTooltip.php:104 +#: src/Module/PermissionTooltip.php:126 msgid "Followers" msgstr "" @@ -3305,8 +3305,8 @@ msgstr "" msgid "Yourself" msgstr "" -#: src/Core/ACL.php:200 src/Module/PermissionTooltip.php:109 -#: src/Module/PermissionTooltip.php:131 +#: src/Core/ACL.php:200 src/Module/PermissionTooltip.php:110 +#: src/Module/PermissionTooltip.php:132 msgid "Mutuals" msgstr "" @@ -3314,7 +3314,7 @@ msgstr "" msgid "Post to Email" msgstr "" -#: src/Core/ACL.php:319 +#: src/Core/ACL.php:319 src/Module/PermissionTooltip.php:166 msgid "Public" msgstr "" @@ -8559,34 +8559,39 @@ msgstr "" msgid "Unsupported or missing grant type" msgstr "" -#: src/Module/PermissionTooltip.php:44 +#: src/Module/PermissionTooltip.php:45 #, php-format msgid "Wrong type \"%s\", expected one of: %s" msgstr "" -#: src/Module/PermissionTooltip.php:61 +#: src/Module/PermissionTooltip.php:62 msgid "Model not found" msgstr "" -#: src/Module/PermissionTooltip.php:88 +#: src/Module/PermissionTooltip.php:89 msgid "Remote privacy information not available." msgstr "" -#: src/Module/PermissionTooltip.php:97 +#: src/Module/PermissionTooltip.php:98 msgid "Visible to:" msgstr "" -#: src/Module/PermissionTooltip.php:174 +#: src/Module/PermissionTooltip.php:170 +#, php-format +msgid "Followers (%s)" +msgstr "" + +#: src/Module/PermissionTooltip.php:184 #, php-format msgid "%d more" msgstr "" -#: src/Module/PermissionTooltip.php:178 +#: src/Module/PermissionTooltip.php:188 #, php-format msgid "To: %s
" msgstr "" -#: src/Module/PermissionTooltip.php:181 +#: src/Module/PermissionTooltip.php:191 #, php-format msgid "CC: %s
" msgstr ""