Merge pull request #11639 from annando/platform-default

Use platform specific default avatar pictures
This commit is contained in:
Hypolite Petovan 2022-06-13 07:59:49 -04:00 committed by GitHub
commit 663296b107
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 107 additions and 46 deletions

View File

@ -1,5 +1,5 @@
-- ------------------------------------------ -- ------------------------------------------
-- Friendica 2022.06 (Giant Rhubarb) -- Friendica 2022.09-dev (Giant Rhubarb)
-- DB_UPDATE_VERSION 1469 -- DB_UPDATE_VERSION 1469
-- ------------------------------------------ -- ------------------------------------------

BIN
images/default/diaspora.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

BIN
images/default/mastodon.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.9 KiB

BIN
images/default/pleroma.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

View File

@ -1817,6 +1817,67 @@ class Contact
} }
if (!DI::config()->get('system', 'remote_avatar_lookup')) { if (!DI::config()->get('system', 'remote_avatar_lookup')) {
$platform = '';
$type = Contact::TYPE_PERSON;
if (!empty($contact['id'])) {
$account = DBA::selectFirst('account-user-view', ['platform', 'contact-type'], ['id' => $contact['id']]);
$platform = $account['platform'] ?? '';
$type = $account['contact-type'] ?? Contact::TYPE_PERSON;
}
if (empty($platform) && !empty($contact['uri-id'])) {
$account = DBA::selectFirst('account-user-view', ['platform', 'contact-type'], ['uri-id' => $contact['uri-id']]);
$platform = $account['platform'] ?? '';
$type = $account['contact-type'] ?? Contact::TYPE_PERSON;
}
switch ($platform) {
case 'mastodon':
/**
* Picture credits
* @license GNU Affero General Public License v3.0
* @link https://github.com/mastodon/mastodon/tree/main/public/avatars/original/missing.png
*/
$default = '/images/default/mastodon.png';
break;
case 'pleroma':
/**
* Picture credits
* @license GNU Affero General Public License v3.0
* @link https://git.pleroma.social/pleroma/pleroma/-/blob/develop/priv/static/images/avi.png
*/
$default = '/images/default/pleroma.png';
break;
case 'diaspora':
/**
* Picture credits
* @license GNU Affero General Public License v3.0
* @link https://github.com/diaspora/diaspora/
*/
$default = '/images/default/diaspora.png';
break;
case 'peertube':
if ($type == Contact::TYPE_COMMUNITY) {
/**
* Picture credits
* @license GNU Affero General Public License v3.0
* @link https://github.com/Chocobozzz/PeerTube/blob/develop/client/src/assets/images/default-avatar-video-channel.png
*/
$default = '/images/default/peertube-channel.png';
} else {
/**
* Picture credits
* @license GNU Affero General Public License v3.0
* @link https://github.com/Chocobozzz/PeerTube/blob/develop/client/src/assets/images/default-avatar-account.png
*/
$default = '/images/default/peertube-account.png';
}
break;
}
return DI::baseUrl() . $default; return DI::baseUrl() . $default;
} }

View File

@ -270,7 +270,7 @@ class Photo extends BaseModule
return MPhoto::createPhotoForExternalResource($link['url'], (int)local_user(), $link['mimetype']); return MPhoto::createPhotoForExternalResource($link['url'], (int)local_user(), $link['mimetype']);
case "contact": case "contact":
$fields = ['uid', 'url', 'nurl', 'avatar', 'photo', 'xmpp', 'addr', 'network', 'failed', 'updated']; $fields = ['uid', 'uri-id', 'url', 'nurl', 'avatar', 'photo', 'xmpp', 'addr', 'network', 'failed', 'updated'];
$contact = Contact::getById($id, $fields); $contact = Contact::getById($id, $fields);
if (empty($contact)) { if (empty($contact)) {
return false; return false;

View File

@ -6,9 +6,9 @@
#, fuzzy #, fuzzy
msgid "" msgid ""
msgstr "" msgstr ""
"Project-Id-Version: 2022.06\n" "Project-Id-Version: 2022.09-dev\n"
"Report-Msgid-Bugs-To: \n" "Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2022-06-06 07:33+0000\n" "POT-Creation-Date: 2022-06-13 05:45+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"
@ -37,7 +37,7 @@ msgstr ""
msgid "User not found." msgid "User not found."
msgstr "" msgstr ""
#: mod/cal.php:122 mod/display.php:247 src/Module/Profile/Profile.php:94 #: mod/cal.php:122 mod/display.php:262 src/Module/Profile/Profile.php:94
#: src/Module/Profile/Profile.php:109 src/Module/Profile/Status.php:110 #: src/Module/Profile/Profile.php:109 src/Module/Profile/Status.php:110
#: src/Module/Update/Profile.php:56 #: src/Module/Update/Profile.php:56
msgid "Access to this profile has been restricted." msgid "Access to this profile has been restricted."
@ -104,17 +104,17 @@ msgstr ""
msgid "calendar" msgid "calendar"
msgstr "" msgstr ""
#: mod/display.php:142 mod/photos.php:802 #: mod/display.php:143 mod/photos.php:802
#: src/Module/Conversation/Community.php:175 src/Module/Directory.php:49 #: src/Module/Conversation/Community.php:175 src/Module/Directory.php:49
#: src/Module/Search/Index.php:50 #: src/Module/Search/Index.php:50
msgid "Public access denied." msgid "Public access denied."
msgstr "" msgstr ""
#: mod/display.php:198 mod/display.php:272 #: mod/display.php:213 mod/display.php:287
msgid "The requested item doesn't exist or has been deleted." msgid "The requested item doesn't exist or has been deleted."
msgstr "" msgstr ""
#: mod/display.php:352 #: mod/display.php:367
msgid "The feed for this item is unavailable." msgid "The feed for this item is unavailable."
msgstr "" msgstr ""
@ -230,7 +230,7 @@ msgstr ""
#: mod/editpost.php:107 mod/message.php:200 mod/message.php:358 #: mod/editpost.php:107 mod/message.php:200 mod/message.php:358
#: mod/photos.php:1489 mod/wallmessage.php:142 src/Content/Conversation.php:368 #: mod/photos.php:1489 mod/wallmessage.php:142 src/Content/Conversation.php:368
#: src/Content/Conversation.php:712 src/Module/Item/Compose.php:177 #: src/Content/Conversation.php:713 src/Module/Item/Compose.php:177
#: src/Object/Post.php:528 #: src/Object/Post.php:528
msgid "Please wait" msgid "Please wait"
msgstr "" msgstr ""
@ -1077,11 +1077,11 @@ msgstr ""
msgid "Comment" msgid "Comment"
msgstr "" msgstr ""
#: mod/photos.php:1424 src/Content/Conversation.php:628 src/Object/Post.php:247 #: mod/photos.php:1424 src/Content/Conversation.php:629 src/Object/Post.php:247
msgid "Select" msgid "Select"
msgstr "" msgstr ""
#: mod/photos.php:1425 mod/settings.php:350 src/Content/Conversation.php:629 #: mod/photos.php:1425 mod/settings.php:350 src/Content/Conversation.php:630
#: src/Module/Admin/Users/Active.php:139 src/Module/Admin/Users/Blocked.php:140 #: src/Module/Admin/Users/Active.php:139 src/Module/Admin/Users/Blocked.php:140
#: src/Module/Admin/Users/Index.php:153 #: src/Module/Admin/Users/Index.php:153
msgid "Delete" msgid "Delete"
@ -1942,7 +1942,7 @@ msgid "%s attends maybe."
msgstr "" msgstr ""
#: src/Content/Conversation.php:222 src/Content/Conversation.php:260 #: src/Content/Conversation.php:222 src/Content/Conversation.php:260
#: src/Content/Conversation.php:872 #: src/Content/Conversation.php:873
#, php-format #, php-format
msgid "%s reshared this." msgid "%s reshared this."
msgstr "" msgstr ""
@ -2061,92 +2061,92 @@ msgstr ""
msgid "Scheduled at" msgid "Scheduled at"
msgstr "" msgstr ""
#: src/Content/Conversation.php:656 src/Object/Post.php:235 #: src/Content/Conversation.php:657 src/Object/Post.php:235
msgid "Pinned item" msgid "Pinned item"
msgstr "" msgstr ""
#: src/Content/Conversation.php:672 src/Object/Post.php:476 #: src/Content/Conversation.php:673 src/Object/Post.php:476
#: src/Object/Post.php:477 #: src/Object/Post.php:477
#, php-format #, php-format
msgid "View %s's profile @ %s" msgid "View %s's profile @ %s"
msgstr "" msgstr ""
#: src/Content/Conversation.php:685 src/Object/Post.php:464 #: src/Content/Conversation.php:686 src/Object/Post.php:464
msgid "Categories:" msgid "Categories:"
msgstr "" msgstr ""
#: src/Content/Conversation.php:686 src/Object/Post.php:465 #: src/Content/Conversation.php:687 src/Object/Post.php:465
msgid "Filed under:" msgid "Filed under:"
msgstr "" msgstr ""
#: src/Content/Conversation.php:694 src/Object/Post.php:490 #: src/Content/Conversation.php:695 src/Object/Post.php:490
#, php-format #, php-format
msgid "%s from %s" msgid "%s from %s"
msgstr "" msgstr ""
#: src/Content/Conversation.php:710 #: src/Content/Conversation.php:711
msgid "View in context" msgid "View in context"
msgstr "" msgstr ""
#: src/Content/Conversation.php:775 #: src/Content/Conversation.php:776
msgid "remove" msgid "remove"
msgstr "" msgstr ""
#: src/Content/Conversation.php:779 #: src/Content/Conversation.php:780
msgid "Delete Selected Items" msgid "Delete Selected Items"
msgstr "" msgstr ""
#: src/Content/Conversation.php:844 src/Content/Conversation.php:847 #: src/Content/Conversation.php:845 src/Content/Conversation.php:848
#: src/Content/Conversation.php:850 src/Content/Conversation.php:853 #: src/Content/Conversation.php:851 src/Content/Conversation.php:854
#, php-format #, php-format
msgid "You had been addressed (%s)." msgid "You had been addressed (%s)."
msgstr "" msgstr ""
#: src/Content/Conversation.php:856 #: src/Content/Conversation.php:857
#, php-format #, php-format
msgid "You are following %s." msgid "You are following %s."
msgstr "" msgstr ""
#: src/Content/Conversation.php:859 #: src/Content/Conversation.php:860
msgid "Tagged" msgid "Tagged"
msgstr "" msgstr ""
#: src/Content/Conversation.php:874 #: src/Content/Conversation.php:875
msgid "Reshared" msgid "Reshared"
msgstr "" msgstr ""
#: src/Content/Conversation.php:874 #: src/Content/Conversation.php:875
#, php-format #, php-format
msgid "Reshared by %s <%s>" msgid "Reshared by %s <%s>"
msgstr "" msgstr ""
#: src/Content/Conversation.php:877 #: src/Content/Conversation.php:878
#, php-format #, php-format
msgid "%s is participating in this thread." msgid "%s is participating in this thread."
msgstr "" msgstr ""
#: src/Content/Conversation.php:880 #: src/Content/Conversation.php:881
msgid "Stored" msgid "Stored"
msgstr "" msgstr ""
#: src/Content/Conversation.php:883 #: src/Content/Conversation.php:884
msgid "Global" msgid "Global"
msgstr "" msgstr ""
#: src/Content/Conversation.php:886 #: src/Content/Conversation.php:887
msgid "Relayed" msgid "Relayed"
msgstr "" msgstr ""
#: src/Content/Conversation.php:886 #: src/Content/Conversation.php:887
#, php-format #, php-format
msgid "Relayed by %s <%s>" msgid "Relayed by %s <%s>"
msgstr "" msgstr ""
#: src/Content/Conversation.php:889 #: src/Content/Conversation.php:890
msgid "Fetched" msgid "Fetched"
msgstr "" msgstr ""
#: src/Content/Conversation.php:889 #: src/Content/Conversation.php:890
#, php-format #, php-format
msgid "Fetched because of %s <%s>" msgid "Fetched because of %s <%s>"
msgstr "" msgstr ""
@ -3625,63 +3625,63 @@ msgstr ""
msgid "Forum" msgid "Forum"
msgstr "" msgstr ""
#: src/Model/Contact.php:2517 #: src/Model/Contact.php:2550
msgid "Disallowed profile URL." msgid "Disallowed profile URL."
msgstr "" msgstr ""
#: src/Model/Contact.php:2522 src/Module/Friendica.php:81 #: src/Model/Contact.php:2555 src/Module/Friendica.php:81
msgid "Blocked domain" msgid "Blocked domain"
msgstr "" msgstr ""
#: src/Model/Contact.php:2527 #: src/Model/Contact.php:2560
msgid "Connect URL missing." msgid "Connect URL missing."
msgstr "" msgstr ""
#: src/Model/Contact.php:2536 #: src/Model/Contact.php:2569
msgid "" msgid ""
"The contact could not be added. Please check the relevant network " "The contact could not be added. Please check the relevant network "
"credentials in your Settings -> Social Networks page." "credentials in your Settings -> Social Networks page."
msgstr "" msgstr ""
#: src/Model/Contact.php:2578 #: src/Model/Contact.php:2611
msgid "The profile address specified does not provide adequate information." msgid "The profile address specified does not provide adequate information."
msgstr "" msgstr ""
#: src/Model/Contact.php:2580 #: src/Model/Contact.php:2613
msgid "No compatible communication protocols or feeds were discovered." msgid "No compatible communication protocols or feeds were discovered."
msgstr "" msgstr ""
#: src/Model/Contact.php:2583 #: src/Model/Contact.php:2616
msgid "An author or name was not found." msgid "An author or name was not found."
msgstr "" msgstr ""
#: src/Model/Contact.php:2586 #: src/Model/Contact.php:2619
msgid "No browser URL could be matched to this address." msgid "No browser URL could be matched to this address."
msgstr "" msgstr ""
#: src/Model/Contact.php:2589 #: src/Model/Contact.php:2622
msgid "" msgid ""
"Unable to match @-style Identity Address with a known protocol or email " "Unable to match @-style Identity Address with a known protocol or email "
"contact." "contact."
msgstr "" msgstr ""
#: src/Model/Contact.php:2590 #: src/Model/Contact.php:2623
msgid "Use mailto: in front of address to force email check." msgid "Use mailto: in front of address to force email check."
msgstr "" msgstr ""
#: src/Model/Contact.php:2596 #: src/Model/Contact.php:2629
msgid "" msgid ""
"The profile address specified belongs to a network which has been disabled " "The profile address specified belongs to a network which has been disabled "
"on this site." "on this site."
msgstr "" msgstr ""
#: src/Model/Contact.php:2601 #: src/Model/Contact.php:2634
msgid "" msgid ""
"Limited profile. This person will be unable to receive direct/personal " "Limited profile. This person will be unable to receive direct/personal "
"notifications from you." "notifications from you."
msgstr "" msgstr ""
#: src/Model/Contact.php:2660 #: src/Model/Contact.php:2693
msgid "Unable to retrieve contact information." msgid "Unable to retrieve contact information."
msgstr "" msgstr ""