Merge pull request #13967 from annando/diaspora-avatar

Issue 13939: Fix avatars for Diaspora
This commit is contained in:
Tobias Diekershoff 2024-03-06 06:55:39 +01:00 committed by GitHub
commit b8b76e870d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 18 additions and 6 deletions

View File

@ -1,6 +1,6 @@
-- ------------------------------------------ -- ------------------------------------------
-- Friendica 2024.03-rc (Yellow Archangel) -- Friendica 2024.03-rc (Yellow Archangel)
-- DB_UPDATE_VERSION 1555 -- DB_UPDATE_VERSION 1556
-- ------------------------------------------ -- ------------------------------------------

View File

@ -48,6 +48,7 @@ use Friendica\Util\Crypto;
use Friendica\Util\DateTimeFormat; use Friendica\Util\DateTimeFormat;
use Friendica\Util\Map; use Friendica\Util\Map;
use Friendica\Util\Network; use Friendica\Util\Network;
use Friendica\Util\Proxy;
use Friendica\Util\Strings; use Friendica\Util\Strings;
use Friendica\Util\XML; use Friendica\Util\XML;
use GuzzleHttp\Psr7\Uri; use GuzzleHttp\Psr7\Uri;
@ -3886,7 +3887,7 @@ class Diaspora
*/ */
private static function createProfileData(int $uid): array private static function createProfileData(int $uid): array
{ {
$profile = DBA::selectFirst('owner-view', ['uid', 'addr', 'name', 'location', 'net-publish', 'dob', 'about', 'pub_keywords', 'updated'], ['uid' => $uid]); $profile = User::getOwnerDataById($uid);
if (!DBA::isResult($profile)) { if (!DBA::isResult($profile)) {
return []; return [];
@ -3900,9 +3901,9 @@ class Diaspora
'full_name' => $profile['name'], 'full_name' => $profile['name'],
'first_name' => $split_name['first'], 'first_name' => $split_name['first'],
'last_name' => $split_name['last'], 'last_name' => $split_name['last'],
'image_url' => DI::baseUrl() . '/photo/custom/300/' . $profile['uid'] . '.jpg', 'image_url' => User::getAvatarUrl($profile, Proxy::SIZE_SMALL),
'image_url_medium' => DI::baseUrl() . '/photo/custom/100/' . $profile['uid'] . '.jpg', 'image_url_medium' => User::getAvatarUrl($profile, Proxy::SIZE_THUMB),
'image_url_small' => DI::baseUrl() . '/photo/custom/50/' . $profile['uid'] . '.jpg', 'image_url_small' => User::getAvatarUrl($profile, Proxy::SIZE_MICRO),
'bio' => null, 'bio' => null,
'birthday' => null, 'birthday' => null,
'gender' => null, 'gender' => null,

View File

@ -56,7 +56,7 @@ use Friendica\Database\DBA;
// This file is required several times during the test in DbaDefinition which justifies this condition // This file is required several times during the test in DbaDefinition which justifies this condition
if (!defined('DB_UPDATE_VERSION')) { if (!defined('DB_UPDATE_VERSION')) {
define('DB_UPDATE_VERSION', 1555); define('DB_UPDATE_VERSION', 1556);
} }
return [ return [

View File

@ -1436,3 +1436,14 @@ function update_1554()
return Update::SUCCESS; return Update::SUCCESS;
} }
function update_1556()
{
$users = DBA::select('user', ['uid'], ['verified' => true, 'blocked' => false, 'account_removed' => false, 'account_expired' => false]);
while ($user = DBA::fetch($users)) {
Worker::add(Worker::PRIORITY_LOW, 'ProfileUpdate', $user['uid']);
}
DBA::close($users);
return Update::SUCCESS;
}