From d9fb081db94b8abdd339178ec56e83439e9fd007 Mon Sep 17 00:00:00 2001 From: Michael Date: Mon, 13 Jun 2022 10:27:46 +0000 Subject: [PATCH] Using separate avatars for different peertube account types --- images/default/peertube-account.png | Bin 0 -> 4944 bytes .../{peertube.png => peertube-channel.png} | Bin src/Model/Contact.php | 16 ++++++++++++---- 3 files changed, 12 insertions(+), 4 deletions(-) create mode 100644 images/default/peertube-account.png rename images/default/{peertube.png => peertube-channel.png} (100%) diff --git a/images/default/peertube-account.png b/images/default/peertube-account.png new file mode 100644 index 0000000000000000000000000000000000000000..0bedaa0c87bf2071ee4170077c28c1be66931854 GIT binary patch literal 4944 zcma)8Wn9!XDgz|f6~q>QxET}q2|NjP-JP=W{w3?U7^ba!_O3=Iw?okOF50z(S} zEbni3KkV+8{c!Gmp68x(&$(aDJrP=(uSkd(hyVZ}QBhXZzTXl5+5_DC^>U`*3jh!i zzSlK`X!~EQ=nXP^8Z2-V`aXaO$2crZybhS0oNS>1Ifrl8TGVS5W z@lORceWt5;vgl)&oIM^4OVz$4g!#bz;(Q^mm zzT4L)x9Q_1n7b8U-xabjin-Ivxhu~=ThlJ7qo!9(tFiE_Z>(pnS^+!(ckHVRUDX#a z1$kr9DcPXLn@eru#*3nupYkVSXyNU@V|?|GXzyeKL@a#mxft2wGvBoxj9=9-OQAC3 zeLw2&^y^+$so?yRgc^%f=#)S$owcDPeo1h4eE>b~xVt*<{yUkyx%-(9IrS>w@9E2F z(#_q*=x?i{9oz|ru4`N9UiYj+Pkkv{8O=G*?)+`~H_i2%OM>cF@fin$M0}f-0nOJl zzBA?KltZ-fV!osEc|qR^1qP}8CEZu&=s7uT7T%dE6&3hba3pd(7t>rYM~4@F)i1LU zvnJq2s+cwP`LB8(ia@P@Ql~=V`&nW!r_{H5I|gR!Oyf;-)mO*V-VuXBHliN4!`wi` z&xmvsIM82ey$jV(noIQQeS511A~1T8LSeIcUR7i)!teW8yu85td)}a^c@u#!sv$H) zz@8f|NFGHlqYvyE@^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#;H zK4gSSOJ>qecaw_;>t%5|35&v{^NtgAMRfm7@xLget('system', 'remote_avatar_lookup')) { $platform = ''; + $type = Contact::TYPE_PERSON; if (!empty($contact['id'])) { - $account = DBA::selectFirst('account-user-view', ['platform'], ['id' => $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'], ['uri-id' => $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) { @@ -1861,9 +1864,14 @@ class Contact /** * 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.png'; + if ($type == Contact::TYPE_COMMUNITY) { + // @link https://github.com/Chocobozzz/PeerTube/blob/develop/client/src/assets/images/default-avatar-video-channel.png + $default = '/images/default/peertube-channel.png'; + } else { + // @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; -- 2.39.5