From 8cc7bad1eafff94733d464df6fb78714833a40b6 Mon Sep 17 00:00:00 2001 From: Michael Date: Wed, 6 Mar 2024 03:00:09 +0000 Subject: [PATCH 1/3] Issue 13939: Fix avatars for Diaspora --- src/Protocol/Diaspora.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Protocol/Diaspora.php b/src/Protocol/Diaspora.php index 15068fd8ad..0b77d748b1 100644 --- a/src/Protocol/Diaspora.php +++ b/src/Protocol/Diaspora.php @@ -3886,7 +3886,7 @@ class Diaspora */ 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 = DBA::selectFirst('owner-view', ['uid', 'addr', 'name', 'location', 'net-publish', 'dob', 'about', 'pub_keywords', 'updated', 'photo', 'thumb', 'micro'], ['uid' => $uid]); if (!DBA::isResult($profile)) { return []; @@ -3900,9 +3900,9 @@ class Diaspora 'full_name' => $profile['name'], 'first_name' => $split_name['first'], 'last_name' => $split_name['last'], - 'image_url' => DI::baseUrl() . '/photo/custom/300/' . $profile['uid'] . '.jpg', - 'image_url_medium' => DI::baseUrl() . '/photo/custom/100/' . $profile['uid'] . '.jpg', - 'image_url_small' => DI::baseUrl() . '/photo/custom/50/' . $profile['uid'] . '.jpg', + 'image_url' => $profile['photo'], + 'image_url_medium' => $profile['thumb'], + 'image_url_small' => $profile['micro'], 'bio' => null, 'birthday' => null, 'gender' => null, From 24e7556f85dcdd44a090670a31ba565efb61156d Mon Sep 17 00:00:00 2001 From: Michael Date: Wed, 6 Mar 2024 03:25:04 +0000 Subject: [PATCH 2/3] Transmit the user avatar path --- src/Protocol/Diaspora.php | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/Protocol/Diaspora.php b/src/Protocol/Diaspora.php index 0b77d748b1..f78c0902cb 100644 --- a/src/Protocol/Diaspora.php +++ b/src/Protocol/Diaspora.php @@ -48,6 +48,7 @@ use Friendica\Util\Crypto; use Friendica\Util\DateTimeFormat; use Friendica\Util\Map; use Friendica\Util\Network; +use Friendica\Util\Proxy; use Friendica\Util\Strings; use Friendica\Util\XML; use GuzzleHttp\Psr7\Uri; @@ -3886,7 +3887,7 @@ class Diaspora */ private static function createProfileData(int $uid): array { - $profile = DBA::selectFirst('owner-view', ['uid', 'addr', 'name', 'location', 'net-publish', 'dob', 'about', 'pub_keywords', 'updated', 'photo', 'thumb', 'micro'], ['uid' => $uid]); + $profile = User::getOwnerDataById($uid); if (!DBA::isResult($profile)) { return []; @@ -3900,9 +3901,9 @@ class Diaspora 'full_name' => $profile['name'], 'first_name' => $split_name['first'], 'last_name' => $split_name['last'], - 'image_url' => $profile['photo'], - 'image_url_medium' => $profile['thumb'], - 'image_url_small' => $profile['micro'], + 'image_url' => User::getAvatarUrl($profile, Proxy::SIZE_SMALL), + 'image_url_medium' => User::getAvatarUrl($profile, Proxy::SIZE_THUMB), + 'image_url_small' => User::getAvatarUrl($profile, Proxy::SIZE_MICRO), 'bio' => null, 'birthday' => null, 'gender' => null, From 41c89abe68b2ca004a0f91397569c9d9d02d5735 Mon Sep 17 00:00:00 2001 From: Michael Date: Wed, 6 Mar 2024 03:41:13 +0000 Subject: [PATCH 3/3] Update routine added --- database.sql | 2 +- static/dbstructure.config.php | 2 +- update.php | 11 +++++++++++ 3 files changed, 13 insertions(+), 2 deletions(-) diff --git a/database.sql b/database.sql index 6889563472..ae71114e5b 100644 --- a/database.sql +++ b/database.sql @@ -1,6 +1,6 @@ -- ------------------------------------------ -- Friendica 2024.03-rc (Yellow Archangel) --- DB_UPDATE_VERSION 1555 +-- DB_UPDATE_VERSION 1556 -- ------------------------------------------ diff --git a/static/dbstructure.config.php b/static/dbstructure.config.php index 70b78f4c77..cfda055818 100644 --- a/static/dbstructure.config.php +++ b/static/dbstructure.config.php @@ -56,7 +56,7 @@ use Friendica\Database\DBA; // This file is required several times during the test in DbaDefinition which justifies this condition if (!defined('DB_UPDATE_VERSION')) { - define('DB_UPDATE_VERSION', 1555); + define('DB_UPDATE_VERSION', 1556); } return [ diff --git a/update.php b/update.php index 7329b84b8d..ffdfa55618 100644 --- a/update.php +++ b/update.php @@ -1436,3 +1436,14 @@ function update_1554() 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; +}