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
-- ------------------------------------------

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 KiB

View file

@ -1817,6 +1817,67 @@ class Contact
}
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;
}

View file

@ -270,7 +270,7 @@ class Photo extends BaseModule
return MPhoto::createPhotoForExternalResource($link['url'], (int)local_user(), $link['mimetype']);
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);
if (empty($contact)) {
return false;

View file

@ -6,9 +6,9 @@
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: 2022.06\n"
"Project-Id-Version: 2022.09-dev\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"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
@ -37,7 +37,7 @@ msgstr ""
msgid "User not found."
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/Update/Profile.php:56
msgid "Access to this profile has been restricted."
@ -104,17 +104,17 @@ msgstr ""
msgid "calendar"
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/Search/Index.php:50
msgid "Public access denied."
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."
msgstr ""
#: mod/display.php:352
#: mod/display.php:367
msgid "The feed for this item is unavailable."
msgstr ""
@ -230,7 +230,7 @@ msgstr ""
#: 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
#: 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
msgid "Please wait"
msgstr ""
@ -1077,11 +1077,11 @@ msgstr ""
msgid "Comment"
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"
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/Index.php:153
msgid "Delete"
@ -1942,7 +1942,7 @@ msgid "%s attends maybe."
msgstr ""
#: src/Content/Conversation.php:222 src/Content/Conversation.php:260
#: src/Content/Conversation.php:872
#: src/Content/Conversation.php:873
#, php-format
msgid "%s reshared this."
msgstr ""
@ -2061,92 +2061,92 @@ msgstr ""
msgid "Scheduled at"
msgstr ""
#: src/Content/Conversation.php:656 src/Object/Post.php:235
#: src/Content/Conversation.php:657 src/Object/Post.php:235
msgid "Pinned item"
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
#, php-format
msgid "View %s's profile @ %s"
msgstr ""
#: src/Content/Conversation.php:685 src/Object/Post.php:464
#: src/Content/Conversation.php:686 src/Object/Post.php:464
msgid "Categories:"
msgstr ""
#: src/Content/Conversation.php:686 src/Object/Post.php:465
#: src/Content/Conversation.php:687 src/Object/Post.php:465
msgid "Filed under:"
msgstr ""
#: src/Content/Conversation.php:694 src/Object/Post.php:490
#: src/Content/Conversation.php:695 src/Object/Post.php:490
#, php-format
msgid "%s from %s"
msgstr ""
#: src/Content/Conversation.php:710
#: src/Content/Conversation.php:711
msgid "View in context"
msgstr ""
#: src/Content/Conversation.php:775
#: src/Content/Conversation.php:776
msgid "remove"
msgstr ""
#: src/Content/Conversation.php:779
#: src/Content/Conversation.php:780
msgid "Delete Selected Items"
msgstr ""
#: src/Content/Conversation.php:844 src/Content/Conversation.php:847
#: src/Content/Conversation.php:850 src/Content/Conversation.php:853
#: src/Content/Conversation.php:845 src/Content/Conversation.php:848
#: src/Content/Conversation.php:851 src/Content/Conversation.php:854
#, php-format
msgid "You had been addressed (%s)."
msgstr ""
#: src/Content/Conversation.php:856
#: src/Content/Conversation.php:857
#, php-format
msgid "You are following %s."
msgstr ""
#: src/Content/Conversation.php:859
#: src/Content/Conversation.php:860
msgid "Tagged"
msgstr ""
#: src/Content/Conversation.php:874
#: src/Content/Conversation.php:875
msgid "Reshared"
msgstr ""
#: src/Content/Conversation.php:874
#: src/Content/Conversation.php:875
#, php-format
msgid "Reshared by %s <%s>"
msgstr ""
#: src/Content/Conversation.php:877
#: src/Content/Conversation.php:878
#, php-format
msgid "%s is participating in this thread."
msgstr ""
#: src/Content/Conversation.php:880
#: src/Content/Conversation.php:881
msgid "Stored"
msgstr ""
#: src/Content/Conversation.php:883
#: src/Content/Conversation.php:884
msgid "Global"
msgstr ""
#: src/Content/Conversation.php:886
#: src/Content/Conversation.php:887
msgid "Relayed"
msgstr ""
#: src/Content/Conversation.php:886
#: src/Content/Conversation.php:887
#, php-format
msgid "Relayed by %s <%s>"
msgstr ""
#: src/Content/Conversation.php:889
#: src/Content/Conversation.php:890
msgid "Fetched"
msgstr ""
#: src/Content/Conversation.php:889
#: src/Content/Conversation.php:890
#, php-format
msgid "Fetched because of %s <%s>"
msgstr ""
@ -3625,63 +3625,63 @@ msgstr ""
msgid "Forum"
msgstr ""
#: src/Model/Contact.php:2517
#: src/Model/Contact.php:2550
msgid "Disallowed profile URL."
msgstr ""
#: src/Model/Contact.php:2522 src/Module/Friendica.php:81
#: src/Model/Contact.php:2555 src/Module/Friendica.php:81
msgid "Blocked domain"
msgstr ""
#: src/Model/Contact.php:2527
#: src/Model/Contact.php:2560
msgid "Connect URL missing."
msgstr ""
#: src/Model/Contact.php:2536
#: src/Model/Contact.php:2569
msgid ""
"The contact could not be added. Please check the relevant network "
"credentials in your Settings -> Social Networks page."
msgstr ""
#: src/Model/Contact.php:2578
#: src/Model/Contact.php:2611
msgid "The profile address specified does not provide adequate information."
msgstr ""
#: src/Model/Contact.php:2580
#: src/Model/Contact.php:2613
msgid "No compatible communication protocols or feeds were discovered."
msgstr ""
#: src/Model/Contact.php:2583
#: src/Model/Contact.php:2616
msgid "An author or name was not found."
msgstr ""
#: src/Model/Contact.php:2586
#: src/Model/Contact.php:2619
msgid "No browser URL could be matched to this address."
msgstr ""
#: src/Model/Contact.php:2589
#: src/Model/Contact.php:2622
msgid ""
"Unable to match @-style Identity Address with a known protocol or email "
"contact."
msgstr ""
#: src/Model/Contact.php:2590
#: src/Model/Contact.php:2623
msgid "Use mailto: in front of address to force email check."
msgstr ""
#: src/Model/Contact.php:2596
#: src/Model/Contact.php:2629
msgid ""
"The profile address specified belongs to a network which has been disabled "
"on this site."
msgstr ""
#: src/Model/Contact.php:2601
#: src/Model/Contact.php:2634
msgid ""
"Limited profile. This person will be unable to receive direct/personal "
"notifications from you."
msgstr ""
#: src/Model/Contact.php:2660
#: src/Model/Contact.php:2693
msgid "Unable to retrieve contact information."
msgstr ""