]> git.mxchange.org Git - friendica.git/blobdiff - src/Model/User.php
Account for the PUBLIC value for id parameter in Depository\PermissionSet::selectOneById
[friendica.git] / src / Model / User.php
index 8f69aa87c8fe925b02279049e8eacf4bba8162b3..263bba99c8355785e4d297df08fc45d089da4612 100644 (file)
@@ -844,12 +844,16 @@ class User
         * Get avatar link for given user
         *
         * @param array  $user
-        * @param string $size One of the ProxyUtils::SIZE_* constants
+        * @param string $size One of the Proxy::SIZE_* constants
         * @return string avatar link
         * @throws Exception
         */
        public static function getAvatarUrl(array $user, string $size = ''):string
        {
+               if (empty($user['nickname'])) {
+                       DI::logger()->warning('Missing user nickname key', ['trace' => System::callstack(20)]);
+               }
+
                $url = DI::baseUrl() . '/photo/';
 
                switch ($size) {
@@ -1157,7 +1161,10 @@ class User
 
                                $resource_id = Photo::newResource();
 
-                               $r = Photo::store($Image, $uid, 0, $resource_id, $filename, DI::l10n()->t('Profile Photos'), 4);
+                               // Not using Photo::PROFILE_PHOTOS here, so that it is discovered as translateble string
+                               $profile_album = DI::l10n()->t('Profile Photos');
+
+                               $r = Photo::store($Image, $uid, 0, $resource_id, $filename, $profile_album, 4);
 
                                if ($r === false) {
                                        $photo_failure = true;
@@ -1165,7 +1172,7 @@ class User
 
                                $Image->scaleDown(80);
 
-                               $r = Photo::store($Image, $uid, 0, $resource_id, $filename, DI::l10n()->t('Profile Photos'), 5);
+                               $r = Photo::store($Image, $uid, 0, $resource_id, $filename, $profile_album, 5);
 
                                if ($r === false) {
                                        $photo_failure = true;
@@ -1173,14 +1180,14 @@ class User
 
                                $Image->scaleDown(48);
 
-                               $r = Photo::store($Image, $uid, 0, $resource_id, $filename, DI::l10n()->t('Profile Photos'), 6);
+                               $r = Photo::store($Image, $uid, 0, $resource_id, $filename, $profile_album, 6);
 
                                if ($r === false) {
                                        $photo_failure = true;
                                }
 
                                if (!$photo_failure) {
-                                       Photo::update(['profile' => 1], ['resource-id' => $resource_id]);
+                                       Photo::update(['profile' => true, 'photo-type' => Photo::USER_AVATAR], ['resource-id' => $resource_id]);
                                }
                        }