Improve the name of the "followers" receiver

This commit is contained in:
Michael 2022-02-23 20:18:37 +00:00
parent 1617e9fc64
commit 59630a2c82
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\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 = '';

View File

@ -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]));
}
}

View File

@ -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 <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\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 "<b>To:</b> %s<br>"
msgstr ""
#: src/Module/PermissionTooltip.php:181
#: src/Module/PermissionTooltip.php:191
#, php-format
msgid "<b>CC:</b> %s<br>"
msgstr ""