From ab88d94150c04b770448caec4da795fe0db322f6 Mon Sep 17 00:00:00 2001 From: Toby Zerner Date: Tue, 22 Sep 2015 17:57:20 +0930 Subject: [PATCH] Refresh discussion metadata to make sure it's correct The new Approval extension may hide new posts, in which case we don't want to increment the comments count/set the last post. --- .../Core/Discussions/Listeners/DiscussionMetadataUpdater.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/framework/core/src/Core/Discussions/Listeners/DiscussionMetadataUpdater.php b/framework/core/src/Core/Discussions/Listeners/DiscussionMetadataUpdater.php index c6e3dd406..0c16e2551 100755 --- a/framework/core/src/Core/Discussions/Listeners/DiscussionMetadataUpdater.php +++ b/framework/core/src/Core/Discussions/Listeners/DiscussionMetadataUpdater.php @@ -38,8 +38,8 @@ class DiscussionMetadataUpdater $discussion = $event->post->discussion; if ($discussion && $discussion->exists) { - $discussion->comments_count++; - $discussion->setLastPost($event->post); + $discussion->refreshCommentsCount(); + $discussion->refreshLastPost(); $discussion->refreshParticipantsCount(); $discussion->save(); }