Compare commits

...

2 commits

Author SHA1 Message Date
Hypolite Petovan 20f2f12871 Merge pull request 'Bluesky: Fix error for missing handles' (#1502) from heluecht/friendica-addons:bluesky-error into develop
Reviewed-on: #1502
Reviewed-by: Hypolite Petovan <hypolite@mrpetovan.com>
2024-05-04 03:06:27 +02:00
Michael 85d254f2f8 Bluesky: Fix error for missing handles 2024-05-04 03:06:27 +02:00

View file

@ -1771,7 +1771,7 @@ function bluesky_get_did(string $handle): string
return $data->did; return $data->did;
} }
function bluesky_get_user_did(int $uid, bool $refresh = false): string function bluesky_get_user_did(int $uid, bool $refresh = false): ?string
{ {
if (!$refresh) { if (!$refresh) {
$did = DI::pConfig()->get($uid, 'bluesky', 'did'); $did = DI::pConfig()->get($uid, 'bluesky', 'did');
@ -1781,7 +1781,9 @@ function bluesky_get_user_did(int $uid, bool $refresh = false): string
} }
$handle = DI::pConfig()->get($uid, 'bluesky', 'handle'); $handle = DI::pConfig()->get($uid, 'bluesky', 'handle');
$did = bluesky_get_did($handle); if (!empty($handle)) {
$did = bluesky_get_did($handle);
}
if (empty($did)) { if (empty($did)) {
Logger::notice('Error fetching DID for handle', ['uid' => $uid, 'handle' => $handle]); Logger::notice('Error fetching DID for handle', ['uid' => $uid, 'handle' => $handle]);
DI::pConfig()->set($uid, 'bluesky', 'status', BLUEKSY_STATUS_DID_FAIL); DI::pConfig()->set($uid, 'bluesky', 'status', BLUEKSY_STATUS_DID_FAIL);