fix(fediverse): use config name to get Fediverse config properties instead of hardcoded class string

This commit is contained in:
Yassine Doghri 2024-02-20 10:01:16 +00:00
parent 4af40b5a71
commit 5fd0980ff7
1 changed files with 4 additions and 5 deletions

View File

@ -11,7 +11,6 @@ declare(strict_types=1);
namespace Modules\Fediverse\Entities; namespace Modules\Fediverse\Entities;
use CodeIgniter\Entity\Entity; use CodeIgniter\Entity\Entity;
use Modules\Fediverse\Config\Fediverse;
use RuntimeException; use RuntimeException;
/** /**
@ -112,7 +111,7 @@ class Actor extends Entity
public function getAvatarImageUrl(): string public function getAvatarImageUrl(): string
{ {
if ($this->attributes['avatar_image_url'] === null) { if ($this->attributes['avatar_image_url'] === null) {
return base_url(config(Fediverse::class)->defaultAvatarImagePath); return base_url(config('Fediverse')->defaultAvatarImagePath);
} }
return $this->attributes['avatar_image_url']; return $this->attributes['avatar_image_url'];
@ -121,7 +120,7 @@ class Actor extends Entity
public function getAvatarImageMimetype(): string public function getAvatarImageMimetype(): string
{ {
if ($this->attributes['avatar_image_mimetype'] === null) { if ($this->attributes['avatar_image_mimetype'] === null) {
return config(Fediverse::class)->defaultAvatarImageMimetype; return config('Fediverse')->defaultAvatarImageMimetype;
} }
return $this->attributes['avatar_image_mimetype']; return $this->attributes['avatar_image_mimetype'];
@ -130,7 +129,7 @@ class Actor extends Entity
public function getCoverImageUrl(): string public function getCoverImageUrl(): string
{ {
if ($this->attributes['cover_image_url'] === null) { if ($this->attributes['cover_image_url'] === null) {
return base_url(config(Fediverse::class)->defaultCoverImagePath); return base_url(config('Fediverse')->defaultCoverImagePath);
} }
return $this->attributes['cover_image_url']; return $this->attributes['cover_image_url'];
@ -139,7 +138,7 @@ class Actor extends Entity
public function getCoverImageMimetype(): string public function getCoverImageMimetype(): string
{ {
if ($this->attributes['cover_image_mimetype'] === null) { if ($this->attributes['cover_image_mimetype'] === null) {
return config(Fediverse::class)->defaultCoverImageMimetype; return config('Fediverse')->defaultCoverImageMimetype;
} }
return $this->attributes['cover_image_mimetype']; return $this->attributes['cover_image_mimetype'];