mirror of
https://github.com/pixelfed/pixelfed.git
synced 2024-11-22 14:31:26 +00:00
Update StatusController
This commit is contained in:
parent
454ae2166c
commit
bbc56b74da
1 changed files with 1 additions and 29 deletions
|
@ -23,7 +23,6 @@ class StatusController extends Controller
|
|||
|
||||
$status = Status::whereProfileId($user->id)
|
||||
->where('visibility', '!=', 'draft')
|
||||
->withCount(['likes', 'comments', 'media'])
|
||||
->findOrFail($id);
|
||||
|
||||
if($status->visibility == 'private' || $user->is_private) {
|
||||
|
@ -40,34 +39,7 @@ class StatusController extends Controller
|
|||
return $this->showActivityPub($request, $status);
|
||||
}
|
||||
|
||||
$template = $this->detectTemplate($status);
|
||||
|
||||
$replies = Status::whereInReplyToId($status->id)->orderBy('created_at', 'desc')->simplePaginate(30);
|
||||
|
||||
return view($template, compact('user', 'status', 'replies'));
|
||||
}
|
||||
|
||||
protected function detectTemplate($status)
|
||||
{
|
||||
$template = Cache::rememberForever('template:status:type:'.$status->id, function () use ($status) {
|
||||
$template = 'status.show.photo';
|
||||
if (!$status->media_path && $status->in_reply_to_id) {
|
||||
$template = 'status.reply';
|
||||
}
|
||||
if ($status->media->count() > 1) {
|
||||
$template = 'status.show.album';
|
||||
}
|
||||
if ($status->viewType() == 'video') {
|
||||
$template = 'status.show.video';
|
||||
}
|
||||
if ($status->viewType() == 'video-album') {
|
||||
$template = 'status.show.video-album';
|
||||
}
|
||||
|
||||
return $template;
|
||||
});
|
||||
|
||||
return $template;
|
||||
return view('status.show', compact('user', 'status'));
|
||||
}
|
||||
|
||||
public function compose()
|
||||
|
|
Loading…
Reference in a new issue