PluginProbe
FluentCommunity – Ultra-Fast High-Performance Social Network, Community, LMS & Online Courses / 2.10.0
FluentCommunity – Ultra-Fast High-Performance Social Network, Community, LMS & Online Courses v2.10.0
2.11.0 2.10.0 2.10.01 2.9.1 2.9.0 2.8.1 2.8.0 2.7.7 2.7.5 2.7.0 2.6.01 2.6.0 2.5.0 2.4.01 trunk 1.0.90 1.0.91 1.0.92 1.0.93 1.0.94 1.0.95 1.0.96 1.0.97 1.0.98 1.0.99 All 78 releases
← All changes | app/Http/Controllers/CommentsController.php +3 -11 2.11.02.10.0 View file →
@@ -144,14 +144,10 @@
144 144 return null;
145 145 }
146 146
147 147 $newComment = Comment::create($commentData);
148 + Feed::withoutGlobalScopes()->where('id', $feed->id)->increment('comments_count');
148 149
149 - // A held comment is not visible yet, so it must not be counted until it is approved.
150 - if ($newComment->status === 'published') {
151 - Feed::withoutGlobalScopes()->where('id', $feed->id)->increment('comments_count');
152 - }
153 -
154 150 return $newComment;
155 151 });
156 152
157 153 if (!$comment) {
@@ -159,11 +155,9 @@
159 155 'message' => __('No duplicate comment please!', 'fluent-community')
160 156 ]);
161 157 }
162 158
163 - if ($comment->status === 'published') {
164 - $feed->comments_count = $feed->comments_count + 1;
165 - }
159 + $feed->comments_count = $feed->comments_count + 1;
166 160
167 161
168 162 // Merge and save all media in one loop
169 163 $mediaItems = $mediaItems ? (is_array($mediaItems) ? $mediaItems : [$mediaItems]) : [];
@@ -619,11 +613,9 @@
619 613 }
620 614
621 615 $comment->delete();
622 616
623 - $feed->comments_count = Comment::where('post_id', $feed->id)
624 - ->where('status', 'published')
625 - ->count();
617 + $feed->comments_count = Comment::where('post_id', $feed->id)->count();
626 618 $feed->timestamps = false; // Don't update the updated_at timestamp
627 619 $feed->save();
628 620
629 621 do_action('fluent_community/comment_deleted_' . $feed->type, $commentId, $feed);