[COMPONENT][Avatar] Small refactor

This commit is contained in:
Hugo Sales 2021-12-04 11:56:27 +00:00
parent 9512890264
commit 969df371dd
Signed by: someonewithpc
GPG Key ID: 7D0C7EAFC9D835A0
3 changed files with 8 additions and 3 deletions

View File

@ -101,7 +101,7 @@ class Avatar extends Component
/**
* Get the cached avatar associated with the given Actor id, or the current user if not given
*/
public static function getAvatarUrl(int $actor_id, string $size = 'full', int $type = Router::ABSOLUTE_PATH): string
public static function getUrl(int $actor_id, string $size = 'full', int $type = Router::ABSOLUTE_PATH): string
{
try {
return self::getAvatar($actor_id)->getUrl($size, $type);

View File

@ -247,7 +247,7 @@ class Actor extends Entity
public function getAvatarUrl(string $size = 'full')
{
return Avatar::getAvatarUrl($this->getId(), $size);
return Avatar::getUrl($this->getId(), $size);
}
public function getAvatarDimensions(string $size = 'full')

View File

@ -213,7 +213,12 @@ class Note extends Entity
public function getActorAvatarUrl(string $size = 'full'): string
{
return Avatar::getAvatarUrl($this->getActorId(), $size);
return Avatar::getUrl($this->getActorId(), $size);
}
public static function getFromId(int $note_id): self
{
return Cache::get("note-{$note_id}", fn () => DB::findOneBy('note', ['id' => $note_id]));
}
public function getNoteLanguageShortDisplay(): string