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.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 1.1.0 All 77 releases
← All changes | app/Http/Controllers/CommentsController.php +12 -3 2.9.02.10.0 View file →
@@ -28,9 +28,18 @@
28 28 'message' => __('Sorry, you do not have permission to view this post', 'fluent-community')
29 29 ], 404);
30 30 }
31 31
32 - $canViewComments = apply_filters('fluent_community/can_view_comments_' . $feed->type, true, $feed);
32 + /*
33 + * The row's own setting is the default the filter gets handed, rather than a bare
34 + * true. Before this, meta.enable_comments was read nowhere on this path, so a page
35 + * with comments switched off still served its thread to anyone who asked for it.
36 + */
37 + $canViewComments = apply_filters(
38 + 'fluent_community/can_view_comments_' . $feed->type,
39 + FeedsHelper::commentsEnabled($feed),
40 + $feed
41 + );
33 42
34 43 if (!$canViewComments) {
35 44 return [
36 45 'comments' => []
@@ -431,9 +440,9 @@
431 440 }
432 441
433 442 private function validateCommentText($data)
434 443 {
435 - $text = trim(Arr::get($data, 'comment'));
444 + $text = trim((string) Arr::get($data, 'comment', ''));
436 445 $text = CustomSanitizer::unslashMarkdown($text);
437 446
438 447 // Decode HTML entities (e.g.,   for space) and strip all whitespace for validation
439 448 $textForValidation = html_entity_decode($text, ENT_QUOTES | ENT_HTML5, 'UTF-8');
@@ -460,9 +469,9 @@
460 469 }
461 470
462 471 private function verifyCreateCommentPermission($feed)
463 472 {
464 - if (Arr::get($feed->meta, 'comments_disabled') === 'yes') {
473 + if (!FeedsHelper::commentsEnabled($feed)) {
465 474 throw new \Exception(esc_html__('Comments are disabled for this post', 'fluent-community'));
466 475 }
467 476
468 477 $this->verifySpacePermission($feed);