Skip to content

Commit c56fae1

Browse files
committed
fix: filter comments by new status field
1 parent 5980e4d commit c56fae1

File tree

4 files changed

+8
-6
lines changed

4 files changed

+8
-6
lines changed

lib/KommentsFrontend.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ public function kommentsAreExpired($page)
4646
public function getCommentList($page): Structure
4747
{
4848
$comments = $this->storage->getCommentsOfPage($page->uuid());
49-
$publishedComments = $comments->filterBy('published', true);
49+
$publishedComments = $comments->filterBy('verification_status', 'PUBLISHED');
5050

5151
return $publishedComments;
5252
}

plugin/fields.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
'queuedComments' => function () {
1212
$storage = StorageFactory::create();
1313
$comments = $storage->getCommentsOfSite();
14-
$unpublishedComments = $comments->filterBy('published', false);
14+
$unpublishedComments = $comments->filterBy('verification_status', 'PUBLISHED');
1515

1616
return $unpublishedComments->count();
1717
},

plugin/page-methods.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
'commentCount' => function ($language = null): int {
77
$storage = StorageFactory::create();
88
$comments = $storage->getCommentsOfPage($this->uuid());
9-
$publishedComments = $comments->filterBy('published', true);
9+
$publishedComments = $comments->filterBy('verification_status', 'PUBLISHED');
1010

1111
if (!is_null($language)) {
1212
$publishedComments = $publishedComments->filterBy('language', $language);

plugin/site-methods.php

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,11 @@
66
'numberOfPendingComments' => function () {
77
$storage = StorageFactory::create();
88
$comments = $storage->getCommentsOfSite();
9-
$unpublishedComments = $comments->filterBy('published', false);
109

11-
if(!option('mauricerenck.komments.panel.webmentions', false)) {
10+
$filter = option('mauricerenck.komments.spam.verification.filterUnverfied', true) ? 'VERIFIED' : 'PENDING';
11+
$unpublishedComments = $comments->filterBy('verification_status', $filter);
12+
13+
if (!option('mauricerenck.komments.panel.webmentions', false)) {
1214
$unpublishedComments = $unpublishedComments->filterBy('type', 'comment');
1315
}
1416

@@ -18,7 +20,7 @@
1820
$storage = StorageFactory::create();
1921
$comments = $storage->getCommentsOfSite();
2022
$spamComments = $comments->filter(
21-
fn ($child) => $child->spamlevel()->value() >= option('mauricerenck.komments.spam.sensibility', 60)
23+
fn($child) => $child->spamlevel()->value() >= option('mauricerenck.komments.spam.sensibility', 60)
2224
);
2325

2426
return $spamComments->count();

0 commit comments

Comments
 (0)