mirror of
https://github.com/flarum/framework.git
synced 2024-11-28 03:32:49 +08: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:
parent
594a2ba8cc
commit
cdbc4b9717
2
js/forum/dist/app.js
vendored
2
js/forum/dist/app.js
vendored
|
@ -33899,7 +33899,7 @@ System.register('flarum/utils/PostControls', ['flarum/components/EditPostCompose
|
|||
|
||||
// If this was the last post in the discussion, then we will assume that
|
||||
// the whole discussion was deleted too.
|
||||
if (!discussion.posts.length) {
|
||||
if (!discussion.postIds().length) {
|
||||
// If there is a discussion list in the cache, remove this discussion.
|
||||
if (app.cache.discussionList) {
|
||||
app.cache.discussionList.removeDiscussion(discussion);
|
||||
|
|
|
@ -155,7 +155,7 @@ export default {
|
|||
|
||||
// If this was the last post in the discussion, then we will assume that
|
||||
// the whole discussion was deleted too.
|
||||
if (!discussion.posts.length) {
|
||||
if (!discussion.postIds().length) {
|
||||
// If there is a discussion list in the cache, remove this discussion.
|
||||
if (app.cache.discussionList) {
|
||||
app.cache.discussionList.removeDiscussion(discussion);
|
||||
|
|
|
@ -54,7 +54,7 @@ class DiscussionMetadataUpdater
|
|||
|
||||
$discussion = $event->post->discussion;
|
||||
|
||||
if ($discussion->comments_count === 0) {
|
||||
if ($discussion->posts()->count() === 0) {
|
||||
$discussion->delete();
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user