Merge pull request #11279 from annando/show-bcc

Display the BCC receiver when it is the local user
This commit is contained in:
Hypolite Petovan 2022-02-24 08:13:35 -05:00 committed by GitHub
commit 093dd70e79
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 53 additions and 28 deletions

View file

@ -24,9 +24,11 @@ namespace Friendica\Module;
use Friendica\Core\Hook; use Friendica\Core\Hook;
use Friendica\Database\DBA; use Friendica\Database\DBA;
use Friendica\DI; use Friendica\DI;
use Friendica\Model\APContact;
use Friendica\Model\Group; use Friendica\Model\Group;
use Friendica\Model\Post; use Friendica\Model\Post;
use Friendica\Model\Tag; use Friendica\Model\Tag;
use Friendica\Model\User;
use Friendica\Network\HTTPException; use Friendica\Network\HTTPException;
use Friendica\Protocol\ActivityPub; use Friendica\Protocol\ActivityPub;
@ -159,15 +161,30 @@ class PermissionTooltip extends \Friendica\BaseModule
*/ */
private function fetchReceivers(int $uriId):string private function fetchReceivers(int $uriId):string
{ {
// We only fetch "to" and "cc", because "bcc" should never be displayed $own_url = '';
$uid = local_user();
if ($uid) {
$owner = User::getOwnerDataById($uid);
if (!empty($owner['url'])) {
$own_url = $owner['url'];
}
}
$receivers = []; $receivers = [];
foreach (Tag::getByURIId($uriId, [Tag::TO, Tag::CC]) as $receiver) { foreach (Tag::getByURIId($uriId, [Tag::TO, Tag::CC, Tag::BCC]) as $receiver) {
// We only display BCC when it contains the current user
if (($receiver['type'] == Tag::BCC) && ($receiver['url'] != $own_url)) {
continue;
}
if ($receiver['url'] == ActivityPub::PUBLIC_COLLECTION) { if ($receiver['url'] == ActivityPub::PUBLIC_COLLECTION) {
$receivers[$receiver['type']][] = DI::l10n()->t('Public'); $receivers[$receiver['type']][] = DI::l10n()->t('Public');
} else { } else {
$apcontact = DBA::selectFirst('apcontact', ['name'], ['followers' => $receiver['url']]); $apcontact = DBA::selectFirst('apcontact', ['name'], ['followers' => $receiver['url']]);
if (!empty($apcontact['name'])) { if (!empty($apcontact['name'])) {
$receivers[$receiver['type']][] = DI::l10n()->t('Followers (%s)', $apcontact['name']); $receivers[$receiver['type']][] = DI::l10n()->t('Followers (%s)', $apcontact['name']);
} elseif ($apcontact = APContact::getByURL($receiver['url'], false)) {
$receivers[$receiver['type']][] = $apcontact['name'];
} else { } else {
$receivers[$receiver['type']][] = $receiver['name']; $receivers[$receiver['type']][] = $receiver['name'];
} }
@ -190,6 +207,9 @@ class PermissionTooltip extends \Friendica\BaseModule
case Tag::CC: case Tag::CC:
$output .= DI::l10n()->t('<b>CC:</b> %s<br>', implode(', ', $receiver)); $output .= DI::l10n()->t('<b>CC:</b> %s<br>', implode(', ', $receiver));
break; break;
case Tag::BCC:
$output .= DI::l10n()->t('<b>BCC:</b> %s<br>', implode(', ', $receiver));
break;
} }
} }

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-23 20:09+0000\n" "POT-Creation-Date: 2022-02-24 07: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"
@ -237,7 +237,7 @@ msgstr ""
msgid "Permission settings" msgid "Permission settings"
msgstr "" msgstr ""
#: mod/editpost.php:116 src/Core/ACL.php:325 #: mod/editpost.php:116 src/Core/ACL.php:326
msgid "CC: email addresses" msgid "CC: email addresses"
msgstr "" msgstr ""
@ -255,7 +255,7 @@ msgstr ""
msgid "Categories (comma-separated list)" msgid "Categories (comma-separated list)"
msgstr "" msgstr ""
#: mod/editpost.php:123 src/Core/ACL.php:326 #: mod/editpost.php:123 src/Core/ACL.php:327
msgid "Example: bob@example.com, mary@example.com" msgid "Example: bob@example.com, mary@example.com"
msgstr "" msgstr ""
@ -2156,9 +2156,9 @@ msgstr ""
msgid "All contacts" 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:194
#: src/Module/Contact.php:367 src/Module/PermissionTooltip.php:104 #: src/Module/Contact.php:367 src/Module/PermissionTooltip.php:106
#: src/Module/PermissionTooltip.php:126 #: src/Module/PermissionTooltip.php:128
msgid "Followers" msgid "Followers"
msgstr "" msgstr ""
@ -3301,49 +3301,49 @@ msgstr ""
msgid "Unfollow" msgid "Unfollow"
msgstr "" msgstr ""
#: src/Core/ACL.php:164 src/Module/Profile/Profile.php:242 #: src/Core/ACL.php:165 src/Module/Profile/Profile.php:242
msgid "Yourself" msgid "Yourself"
msgstr "" msgstr ""
#: src/Core/ACL.php:200 src/Module/PermissionTooltip.php:110 #: src/Core/ACL.php:201 src/Module/PermissionTooltip.php:112
#: src/Module/PermissionTooltip.php:132 #: src/Module/PermissionTooltip.php:134
msgid "Mutuals" msgid "Mutuals"
msgstr "" msgstr ""
#: src/Core/ACL.php:292 #: src/Core/ACL.php:293
msgid "Post to Email" msgid "Post to Email"
msgstr "" msgstr ""
#: src/Core/ACL.php:319 src/Module/PermissionTooltip.php:166 #: src/Core/ACL.php:320 src/Module/PermissionTooltip.php:181
msgid "Public" msgid "Public"
msgstr "" msgstr ""
#: src/Core/ACL.php:320 #: src/Core/ACL.php:321
msgid "" msgid ""
"This content will be shown to all your followers and can be seen in the " "This content will be shown to all your followers and can be seen in the "
"community pages and by anyone with its link." "community pages and by anyone with its link."
msgstr "" msgstr ""
#: src/Core/ACL.php:321 #: src/Core/ACL.php:322
msgid "Limited/Private" msgid "Limited/Private"
msgstr "" msgstr ""
#: src/Core/ACL.php:322 #: src/Core/ACL.php:323
msgid "" msgid ""
"This content will be shown only to the people in the first box, to the " "This content will be shown only to the people in the first box, to the "
"exception of the people mentioned in the second box. It won't appear " "exception of the people mentioned in the second box. It won't appear "
"anywhere public." "anywhere public."
msgstr "" msgstr ""
#: src/Core/ACL.php:323 #: src/Core/ACL.php:324
msgid "Show to:" msgid "Show to:"
msgstr "" msgstr ""
#: src/Core/ACL.php:324 #: src/Core/ACL.php:325
msgid "Except to:" msgid "Except to:"
msgstr "" msgstr ""
#: src/Core/ACL.php:327 #: src/Core/ACL.php:328
msgid "Connectors" msgid "Connectors"
msgstr "" msgstr ""
@ -4275,7 +4275,7 @@ msgstr ""
msgid "View on separate page" msgid "View on separate page"
msgstr "" msgstr ""
#: src/Model/Mail.php:134 src/Model/Mail.php:266 #: src/Model/Mail.php:137 src/Model/Mail.php:265
msgid "[no subject]" msgid "[no subject]"
msgstr "" msgstr ""
@ -8559,43 +8559,48 @@ msgstr ""
msgid "Unsupported or missing grant type" msgid "Unsupported or missing grant type"
msgstr "" msgstr ""
#: src/Module/PermissionTooltip.php:45 #: src/Module/PermissionTooltip.php:47
#, 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:62 #: src/Module/PermissionTooltip.php:64
msgid "Model not found" msgid "Model not found"
msgstr "" msgstr ""
#: src/Module/PermissionTooltip.php:89 #: src/Module/PermissionTooltip.php:91
msgid "Remote privacy information not available." msgid "Remote privacy information not available."
msgstr "" msgstr ""
#: src/Module/PermissionTooltip.php:98 #: src/Module/PermissionTooltip.php:100
msgid "Visible to:" msgid "Visible to:"
msgstr "" msgstr ""
#: src/Module/PermissionTooltip.php:170 #: src/Module/PermissionTooltip.php:185
#, php-format #, php-format
msgid "Followers (%s)" msgid "Followers (%s)"
msgstr "" msgstr ""
#: src/Module/PermissionTooltip.php:184 #: src/Module/PermissionTooltip.php:201
#, php-format #, php-format
msgid "%d more" msgid "%d more"
msgstr "" msgstr ""
#: src/Module/PermissionTooltip.php:188 #: src/Module/PermissionTooltip.php:205
#, php-format #, php-format
msgid "<b>To:</b> %s<br>" msgid "<b>To:</b> %s<br>"
msgstr "" msgstr ""
#: src/Module/PermissionTooltip.php:191 #: src/Module/PermissionTooltip.php:208
#, php-format #, php-format
msgid "<b>CC:</b> %s<br>" msgid "<b>CC:</b> %s<br>"
msgstr "" msgstr ""
#: src/Module/PermissionTooltip.php:211
#, php-format
msgid "<b>BCC:</b> %s<br>"
msgstr ""
#: src/Module/Photo.php:123 #: src/Module/Photo.php:123
msgid "The Photo is not available." msgid "The Photo is not available."
msgstr "" msgstr ""