Merge pull request #11278 from annando/receiver-name

Improve the name of the "followers" receiver
This commit is contained in:
Hypolite Petovan 2022-02-23 15:30:33 -05:00 committed by GitHub
commit f6e4984d7e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 30 additions and 15 deletions

View file

@ -28,6 +28,7 @@ use Friendica\Model\Group;
use Friendica\Model\Post; use Friendica\Model\Post;
use Friendica\Model\Tag; use Friendica\Model\Tag;
use Friendica\Network\HTTPException; use Friendica\Network\HTTPException;
use Friendica\Protocol\ActivityPub;
/** /**
* Outputs the permission tooltip HTML content for the provided item, photo or event id. * 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 // We only fetch "to" and "cc", because "bcc" should never be displayed
$receivers = []; $receivers = [];
foreach (Tag::getByURIId($uriId, [Tag::TO, Tag::CC]) as $receiver) { 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 = ''; $output = '';

View file

@ -415,7 +415,7 @@ class Receiver
} }
foreach (['as:to', 'as:cc', 'as:bto', 'as:bcc'] as $element) { 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])); $object_data['receiver_urls'][$element] = array_unique(array_merge($object_data['receiver_urls'][$element] ?? [], $urls[$element]));
} }
} }

View file

@ -8,7 +8,7 @@ msgid ""
msgstr "" msgstr ""
"Project-Id-Version: 2022.05-dev\n" "Project-Id-Version: 2022.05-dev\n"
"Report-Msgid-Bugs-To: \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" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n" "Language-Team: LANGUAGE <LL@li.org>\n"
@ -2157,8 +2157,8 @@ msgid "All contacts"
msgstr "" msgstr ""
#: src/BaseModule.php:409 src/Content/Widget.php:231 src/Core/ACL.php:193 #: 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/Contact.php:367 src/Module/PermissionTooltip.php:104
#: src/Module/PermissionTooltip.php:125 #: src/Module/PermissionTooltip.php:126
msgid "Followers" msgid "Followers"
msgstr "" msgstr ""
@ -3305,8 +3305,8 @@ msgstr ""
msgid "Yourself" msgid "Yourself"
msgstr "" msgstr ""
#: src/Core/ACL.php:200 src/Module/PermissionTooltip.php:109 #: src/Core/ACL.php:200 src/Module/PermissionTooltip.php:110
#: src/Module/PermissionTooltip.php:131 #: src/Module/PermissionTooltip.php:132
msgid "Mutuals" msgid "Mutuals"
msgstr "" msgstr ""
@ -3314,7 +3314,7 @@ msgstr ""
msgid "Post to Email" msgid "Post to Email"
msgstr "" msgstr ""
#: src/Core/ACL.php:319 #: src/Core/ACL.php:319 src/Module/PermissionTooltip.php:166
msgid "Public" msgid "Public"
msgstr "" msgstr ""
@ -8559,34 +8559,39 @@ msgstr ""
msgid "Unsupported or missing grant type" msgid "Unsupported or missing grant type"
msgstr "" msgstr ""
#: src/Module/PermissionTooltip.php:44 #: src/Module/PermissionTooltip.php:45
#, php-format #, php-format
msgid "Wrong type \"%s\", expected one of: %s" msgid "Wrong type \"%s\", expected one of: %s"
msgstr "" msgstr ""
#: src/Module/PermissionTooltip.php:61 #: src/Module/PermissionTooltip.php:62
msgid "Model not found" msgid "Model not found"
msgstr "" msgstr ""
#: src/Module/PermissionTooltip.php:88 #: src/Module/PermissionTooltip.php:89
msgid "Remote privacy information not available." msgid "Remote privacy information not available."
msgstr "" msgstr ""
#: src/Module/PermissionTooltip.php:97 #: src/Module/PermissionTooltip.php:98
msgid "Visible to:" msgid "Visible to:"
msgstr "" msgstr ""
#: src/Module/PermissionTooltip.php:174 #: src/Module/PermissionTooltip.php:170
#, php-format
msgid "Followers (%s)"
msgstr ""
#: src/Module/PermissionTooltip.php:184
#, php-format #, php-format
msgid "%d more" msgid "%d more"
msgstr "" msgstr ""
#: src/Module/PermissionTooltip.php:178 #: src/Module/PermissionTooltip.php:188
#, php-format #, php-format
msgid "<b>To:</b> %s<br>" msgid "<b>To:</b> %s<br>"
msgstr "" msgstr ""
#: src/Module/PermissionTooltip.php:181 #: src/Module/PermissionTooltip.php:191
#, php-format #, php-format
msgid "<b>CC:</b> %s<br>" msgid "<b>CC:</b> %s<br>"
msgstr "" msgstr ""