Add tests for featured thumbnail generation; apply Pint formatting and related edits

This commit is contained in:
2026-05-06 18:55:40 +02:00
parent 7a8bc8e22a
commit 82f2b1f660
65 changed files with 11325 additions and 49545 deletions

View File

@@ -12,6 +12,10 @@ use cPad\Plugins\News\Models\NewsArticle;
final class NewsArticleCommentService
{
public function __construct(private readonly NewsService $news)
{
}
public function create(NewsArticle $article, User $actor, string $body, ?NewsArticleComment $parent = null): NewsArticleComment
{
if (! $article->commentsAreEnabled()) {
@@ -42,6 +46,8 @@ final class NewsArticleCommentService
'status' => 'visible',
]);
$this->news->invalidatePublicCache();
return $comment->fresh(['user.profile', 'replies.user.profile']);
}
@@ -60,6 +66,8 @@ final class NewsArticleCommentService
}
$comment->delete();
$this->news->invalidatePublicCache();
}
private function canDelete(NewsArticleComment $comment, NewsArticle $article, User $actor): bool