mirror of
https://github.com/pixelfed/pixelfed.git
synced 2024-11-22 14:31:26 +00:00
Update Status model, allow unlisted thumbnails
This commit is contained in:
parent
2d428f43e8
commit
1f0a45b7f4
1 changed files with 5 additions and 1 deletions
|
@ -97,7 +97,7 @@ class Status extends Model
|
||||||
|
|
||||||
public function thumb($showNsfw = false)
|
public function thumb($showNsfw = false)
|
||||||
{
|
{
|
||||||
$entity = StatusService::get($this->id);
|
$entity = StatusService::get($this->id, false);
|
||||||
|
|
||||||
if(!$entity || !isset($entity['media_attachments']) || empty($entity['media_attachments'])) {
|
if(!$entity || !isset($entity['media_attachments']) || empty($entity['media_attachments'])) {
|
||||||
return url(Storage::url('public/no-preview.png'));
|
return url(Storage::url('public/no-preview.png'));
|
||||||
|
@ -107,6 +107,10 @@ class Status extends Model
|
||||||
return url(Storage::url('public/no-preview.png'));
|
return url(Storage::url('public/no-preview.png'));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(!isset($entity['visibility']) || !in_array($entity['visibility'], ['public', 'unlisted'])) {
|
||||||
|
return url(Storage::url('public/no-preview.png'));
|
||||||
|
}
|
||||||
|
|
||||||
return collect($entity['media_attachments'])
|
return collect($entity['media_attachments'])
|
||||||
->filter(fn($media) => $media['type'] == 'image' && in_array($media['mime'], ['image/jpeg', 'image/png']))
|
->filter(fn($media) => $media['type'] == 'image' && in_array($media['mime'], ['image/jpeg', 'image/png']))
|
||||||
->map(function($media) {
|
->map(function($media) {
|
||||||
|
|
Loading…
Reference in a new issue