mirror of
https://github.com/pixelfed/pixelfed.git
synced 2024-11-22 06:21:27 +00:00
Update Status model
This commit is contained in:
parent
d09b00a70f
commit
402408e48c
1 changed files with 8 additions and 5 deletions
|
@ -87,7 +87,7 @@ class Status extends Model
|
|||
return Cache::remember('status:thumb:'.$this->id, now()->addMinutes(15), function() use ($showNsfw) {
|
||||
$type = $this->type ?? $this->setType();
|
||||
$is_nsfw = !$showNsfw ? $this->is_nsfw : false;
|
||||
if ($this->media->count() == 0 || $is_nsfw || !in_array($type,['photo', 'photo:album'])) {
|
||||
if ($this->media->count() == 0 || $is_nsfw || !in_array($type,['photo', 'photo:album', 'video'])) {
|
||||
return url(Storage::url('public/no-preview.png'));
|
||||
}
|
||||
|
||||
|
@ -99,11 +99,12 @@ class Status extends Model
|
|||
{
|
||||
if($this->uri) {
|
||||
return $this->uri;
|
||||
} else {
|
||||
$id = $this->id;
|
||||
$username = $this->profile->username;
|
||||
$path = url(config('app.url')."/p/{$username}/{$id}");
|
||||
return $path;
|
||||
}
|
||||
$id = $this->id;
|
||||
$username = $this->profile->username;
|
||||
$path = url(config('app.url')."/p/{$username}/{$id}");
|
||||
return $path;
|
||||
}
|
||||
|
||||
public function permalink($suffix = '/activity')
|
||||
|
@ -207,6 +208,8 @@ class Status extends Model
|
|||
$parent = $this->in_reply_to_id ?? $this->reblog_of_id;
|
||||
if (!empty($parent)) {
|
||||
return $this->findOrFail($parent);
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue