forked from mirror/pixelfed
Merge branch 'dev' of https://github.com/dansup/pixelfed into dev
This commit is contained in:
commit
0c90178eaf
|
@ -125,13 +125,15 @@ class Profile extends Model
|
||||||
|
|
||||||
public function avatar()
|
public function avatar()
|
||||||
{
|
{
|
||||||
return $this->hasOne(Avatar::class);
|
return $this->hasOne(Avatar::class)->withDefault([
|
||||||
|
'media_path' => 'public/avatars/default.png'
|
||||||
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function avatarUrl()
|
public function avatarUrl()
|
||||||
{
|
{
|
||||||
$url = Cache::remember("avatar:{$this->id}", 1440, function() {
|
$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);
|
$version = hash('sha1', $this->avatar->created_at);
|
||||||
$path = "{$path}?v={$version}";
|
$path = "{$path}?v={$version}";
|
||||||
return url(Storage::url($path));
|
return url(Storage::url($path));
|
||||||
|
|
|
@ -50,7 +50,6 @@ class ProfileOutbox extends Fractal\TransformerAbstract
|
||||||
'sensitive' => (bool) $i->is_nsfw,
|
'sensitive' => (bool) $i->is_nsfw,
|
||||||
'atomUri' => $i->url(),
|
'atomUri' => $i->url(),
|
||||||
'inReplyToAtomUri' => null,
|
'inReplyToAtomUri' => null,
|
||||||
'conversation' => $i->url(),
|
|
||||||
'attachment' => [
|
'attachment' => [
|
||||||
|
|
||||||
// TODO: support more than 1 attachment
|
// TODO: support more than 1 attachment
|
||||||
|
|
|
@ -46,7 +46,6 @@ class StatusTransformer extends Fractal\TransformerAbstract
|
||||||
'sensitive' => (bool) $status->is_nsfw,
|
'sensitive' => (bool) $status->is_nsfw,
|
||||||
'atomUri' => $status->url(),
|
'atomUri' => $status->url(),
|
||||||
'inReplyToAtomUri' => null,
|
'inReplyToAtomUri' => null,
|
||||||
'conversation' => $status->url(),
|
|
||||||
'attachment' => $status->media->map(function($media) {
|
'attachment' => $status->media->map(function($media) {
|
||||||
return [
|
return [
|
||||||
'type' => 'Document',
|
'type' => 'Document',
|
||||||
|
|
Loading…
Reference in New Issue