mirror of
https://github.com/pixelfed/pixelfed.git
synced 2024-11-19 04:51:27 +00:00
Merge pull request #4667 from pixelfed/staging
Update Status model, allow unlisted thumbnails
This commit is contained in:
commit
b2195ca837
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