Update RemotAvatarFetch, only dispatch jobs if cloud storage is enabled

This commit is contained in:
Daniel Supernault 2021-01-30 09:47:02 -07:00
parent 5a116c7ae0
commit 4f40f6f5a1
No known key found for this signature in database
GPG key ID: 0DEF1C662C9033F7
2 changed files with 10 additions and 2 deletions

View file

@ -51,6 +51,10 @@ class RemoteAvatarFetch implements ShouldQueue
{
$profile = $this->profile;
if(config('pixelfed.cloud_storage') !== true) {
return 1;
}
if($profile->domain == null || $profile->private_key) {
return 1;
}

View file

@ -474,7 +474,9 @@ class Helpers {
$profile->webfinger = strtolower(Purify::clean($webfinger));
$profile->last_fetched_at = now();
$profile->save();
RemoteAvatarFetch::dispatch($profile);
if(config('pixelfed.cloud_storage') == true) {
RemoteAvatarFetch::dispatch($profile);
}
return $profile;
});
} else {
@ -488,7 +490,9 @@ class Helpers {
$profile->sharedInbox = isset($res['endpoints']) && isset($res['endpoints']['sharedInbox']) && Helpers::validateUrl($res['endpoints']['sharedInbox']) ? $res['endpoints']['sharedInbox'] : null;
$profile->save();
}
RemoteAvatarFetch::dispatch($profile);
if(config('pixelfed.cloud_storage') == true) {
RemoteAvatarFetch::dispatch($profile);
}
}
return $profile;
});