Herzen und Kommentare schon in der Vorschau (0.44.0)
Some checks failed
CI / PHP 8.3 / mariadb:10.6 (pull_request) Successful in 7m6s
CI / PHP 8.4 / mariadb:10.6 (pull_request) Successful in 7m4s
CI / PHP 8.3 / mariadb:11.4 (pull_request) Successful in 7m25s
CI / PHP 8.4 / mariadb:11.4 (pull_request) Successful in 8m3s
CI / PHP 8.3 / mysql:8.0 (pull_request) Failing after 10m26s
CI / PHP 8.4 / mysql:8.0 (pull_request) Failing after 9m49s
CI / PHP 8.3 / mysql:8.4 (pull_request) Failing after 9m1s
CI / PHP 8.4 / mysql:8.4 (pull_request) Failing after 8m41s
CI / Bekannte Sicherheitslücken in Paketen (pull_request) Successful in 45s
CI / Build-Artefakte aktuell (pull_request) Successful in 1m6s
Some checks failed
CI / PHP 8.3 / mariadb:10.6 (pull_request) Successful in 7m6s
CI / PHP 8.4 / mariadb:10.6 (pull_request) Successful in 7m4s
CI / PHP 8.3 / mariadb:11.4 (pull_request) Successful in 7m25s
CI / PHP 8.4 / mariadb:11.4 (pull_request) Successful in 8m3s
CI / PHP 8.3 / mysql:8.0 (pull_request) Failing after 10m26s
CI / PHP 8.4 / mysql:8.0 (pull_request) Failing after 9m49s
CI / PHP 8.3 / mysql:8.4 (pull_request) Failing after 9m1s
CI / PHP 8.4 / mysql:8.4 (pull_request) Failing after 8m41s
CI / Bekannte Sicherheitslücken in Paketen (pull_request) Successful in 45s
CI / Build-Artefakte aktuell (pull_request) Successful in 1m6s
- NewsPost::withStats: Herzen (Anzahl, eigenes) und Kommentare (Anzahl) für alle Vorschau-Abfragen: Übersicht, Widgets, Slider, Block, Profil, „Weitere Beiträge“, API - NewsPostResource: „comments“ (null bei ausgeschalteten Kommentaren) - NewsStats.vue in Karte, Listeneintrag, Block-Layouts, Slider und Seitenleiste Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
60dd200300
commit
21307fc953
145 changed files with 471 additions and 358 deletions
|
|
@ -82,7 +82,7 @@ class NewsPlugin extends Plugin
|
|||
|
||||
return $total === 0 ? null : [
|
||||
'total' => $total,
|
||||
'posts' => NewsPostResource::collection($query->with('category')->latest('published_at')->limit(4)->get())->resolve(),
|
||||
'posts' => NewsPostResource::collection($query->with('category')->withStats($viewer)->latest('published_at')->limit(4)->get())->resolve(),
|
||||
'all_url' => '/neuigkeiten?autor='.$person->id,
|
||||
];
|
||||
});
|
||||
|
|
@ -140,7 +140,7 @@ class NewsPlugin extends Plugin
|
|||
])
|
||||
->resolveUsing(function (array $data, ?User $user) {
|
||||
$slugs = $data['filter'] === 'all' ? [] : $data['categories'];
|
||||
$posts = NewsPost::query()->published()->visibleTo($user)->with('category')
|
||||
$posts = NewsPost::query()->published()->visibleTo($user)->with('category')->withStats($user)
|
||||
->when($slugs !== [] && $data['filter'] === 'include', fn ($q) => $q->whereHas('category', fn ($c) => $c->whereIn('slug', $slugs)))
|
||||
->when($slugs !== [] && $data['filter'] === 'exclude', fn ($q) => $q->where(fn ($q) => $q->whereNull('category_id')->orWhereHas('category', fn ($c) => $c->whereNotIn('slug', $slugs))))
|
||||
->latest('published_at')->limit($data['count'])->get();
|
||||
|
|
@ -204,7 +204,7 @@ class NewsPlugin extends Plugin
|
|||
}, label: 'Slider mit hervorgehobenen Beiträgen', mobileSort: 10);
|
||||
|
||||
$widgets->add('news.latest', 'news::Latest', 'feed', sort: 10, props: function (User $user, Request $request) {
|
||||
$posts = NewsPost::query()->published()->visibleTo($user)->with('category')
|
||||
$posts = NewsPost::query()->published()->visibleTo($user)->with('category')->withStats($user)
|
||||
->whereKeyNot($this->featured($user)->modelKeys())
|
||||
->latest('published_at')->limit(4)->get();
|
||||
|
||||
|
|
@ -215,7 +215,7 @@ class NewsPlugin extends Plugin
|
|||
}, label: 'Neuigkeiten', mobileSort: 20);
|
||||
|
||||
$widgets->add('news.areas', 'news::Areas', 'main', sort: 20, props: function (User $user) {
|
||||
$posts = NewsPost::query()->published()->visibleTo($user)->with('category')
|
||||
$posts = NewsPost::query()->published()->visibleTo($user)->with('category')->withStats($user)
|
||||
->whereKeyNot($this->featured($user)->modelKeys())
|
||||
->latest('published_at')->skip(4)->limit(8)->get();
|
||||
|
||||
|
|
@ -231,11 +231,11 @@ class NewsPlugin extends Plugin
|
|||
static $cache = [];
|
||||
|
||||
return $cache[$user->id] ??= (function () use ($user) {
|
||||
$featured = NewsPost::query()->published()->visibleTo($user)->with('category')
|
||||
$featured = NewsPost::query()->published()->visibleTo($user)->with('category')->withStats($user)
|
||||
->where('is_featured', true)->whereNotNull('cover_path')
|
||||
->latest('published_at')->limit(5)->get();
|
||||
|
||||
return $featured->isNotEmpty() ? $featured : NewsPost::query()->published()->visibleTo($user)->with('category')
|
||||
return $featured->isNotEmpty() ? $featured : NewsPost::query()->published()->visibleTo($user)->with('category')->withStats($user)
|
||||
->whereNotNull('cover_path')->latest('published_at')->limit(3)->get();
|
||||
})();
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue