mirror of
https://github.com/flarum/core.git
synced 2025-08-05 16:07:34 +02:00
Fix regressions related to deleting posts
- On the front-end, correct the check to see if the discussion has no more posts - On the back-end, run a query to count the posts instead of using the comments_count, because the comments_count does not include other deleted posts
This commit is contained in:
@@ -54,7 +54,7 @@ class DiscussionMetadataUpdater
|
||||
|
||||
$discussion = $event->post->discussion;
|
||||
|
||||
if ($discussion->comments_count === 0) {
|
||||
if ($discussion->posts()->count() === 0) {
|
||||
$discussion->delete();
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user