diff --git a/app/Http/Controllers/Microblog/HomeController.php b/app/Http/Controllers/Microblog/HomeController.php index 87b5d238d..43a497099 100644 --- a/app/Http/Controllers/Microblog/HomeController.php +++ b/app/Http/Controllers/Microblog/HomeController.php @@ -6,6 +6,7 @@ use Coyote\Http\Resources\MicroblogCollection; use Coyote\Http\Resources\MicroblogResource; use Coyote\Http\Resources\UserResource; +use Coyote\Microblog; use Coyote\Repositories\Eloquent\MicroblogRepository; use Coyote\Services\Microblogs; use Coyote\Services\Parser\Extensions\Emoji; @@ -63,7 +64,7 @@ public function show(int $id): View { $microblog = $this->builder->one($id); abort_if(!is_null($microblog->parent_id), 404); - $excerpt = excerpt($microblog->html); + $excerpt = $this->title($microblog); $this->breadcrumb->push($excerpt, route('microblog.view', [$microblog->id])); MicroblogResource::withoutWrapping(); $resource = new MicroblogResource($microblog); @@ -79,6 +80,15 @@ public function show(int $id): View ]); } + private function title(Microblog $microblog): string + { + $excerpt = excerpt($microblog->html); + if ($excerpt) { + return $excerpt; + } + return 'Wpis użytkownika: ' . $microblog->user->name; + } + private function tags(): array { $tags = $this->getCacheFactory()->remember('microblog:tags', 30 * 60, fn() => $this->microblog->getTags()); diff --git a/resources/views/layout.twig b/resources/views/layout.twig index 6ed34a108..817e8be57 100644 --- a/resources/views/layout.twig +++ b/resources/views/layout.twig @@ -16,7 +16,7 @@ {% endblock %} {% block head %} -