mirror of
https://github.com/pixelfed/pixelfed.git
synced 2024-11-22 14:31:26 +00:00
Merge branch 'dev' of https://github.com/dansup/pixelfed into dev
This commit is contained in:
commit
0c90178eaf
3 changed files with 4 additions and 4 deletions
|
@ -125,13 +125,15 @@ class Profile extends Model
|
|||
|
||||
public function avatar()
|
||||
{
|
||||
return $this->hasOne(Avatar::class);
|
||||
return $this->hasOne(Avatar::class)->withDefault([
|
||||
'media_path' => 'public/avatars/default.png'
|
||||
]);
|
||||
}
|
||||
|
||||
public function avatarUrl()
|
||||
{
|
||||
$url = Cache::remember("avatar:{$this->id}", 1440, function() {
|
||||
$path = $this->avatar->media_path ?? 'public/avatars/default.png';
|
||||
$path = optional($this->avatar)->media_path;
|
||||
$version = hash('sha1', $this->avatar->created_at);
|
||||
$path = "{$path}?v={$version}";
|
||||
return url(Storage::url($path));
|
||||
|
|
|
@ -50,7 +50,6 @@ class ProfileOutbox extends Fractal\TransformerAbstract
|
|||
'sensitive' => (bool) $i->is_nsfw,
|
||||
'atomUri' => $i->url(),
|
||||
'inReplyToAtomUri' => null,
|
||||
'conversation' => $i->url(),
|
||||
'attachment' => [
|
||||
|
||||
// TODO: support more than 1 attachment
|
||||
|
|
|
@ -46,7 +46,6 @@ class StatusTransformer extends Fractal\TransformerAbstract
|
|||
'sensitive' => (bool) $status->is_nsfw,
|
||||
'atomUri' => $status->url(),
|
||||
'inReplyToAtomUri' => null,
|
||||
'conversation' => $status->url(),
|
||||
'attachment' => $status->media->map(function($media) {
|
||||
return [
|
||||
'type' => 'Document',
|
||||
|
|
Loading…
Reference in a new issue