Skip to content

Commit

Permalink
fix: comment moderation on non-primary language
Browse files Browse the repository at this point in the history
  • Loading branch information
mauricerenck committed Apr 30, 2024
1 parent 1777242 commit 3bda0f2
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 8 deletions.
12 changes: 8 additions & 4 deletions utils/moderation.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ public function markAsSpam($pageSlug, $kommentId, $isSpam)
throw new Exception('Page not found', 1);
}

$fieldData = $targetPage->kommentsInbox()->yaml();
$fieldData = $baseUtils->getAllCommentsOfPage($targetPage);
$fieldData = $fieldData->toArray();

for ($i = 0; $i < count($fieldData); $i++) {
if (isset($fieldData[$i]['id'])) {
Expand Down Expand Up @@ -58,7 +59,8 @@ public function markAsVerified($pageSlug, $kommentId, $isVerified)
throw new Exception('Page not found', 1);
}

$fieldData = $targetPage->kommentsInbox()->yaml();
$fieldData = $baseUtils->getAllCommentsOfPage($targetPage);
$fieldData = $fieldData->toArray();

for ($i = 0; $i < count($fieldData); $i++) {
if (isset($fieldData[$i]['id'])) {
Expand Down Expand Up @@ -92,7 +94,8 @@ public function publish($pageSlug, $kommentId, $publish)
throw new Exception('Page not found', 1);
}

$fieldData = $targetPage->kommentsInbox()->yaml();
$fieldData = $baseUtils->getAllCommentsOfPage($targetPage);
$fieldData = $fieldData->toArray();

for ($i = 0; $i < count($fieldData); $i++) {
if (isset($fieldData[$i]['id'])) {
Expand Down Expand Up @@ -126,7 +129,8 @@ public function delete($pageSlug, $kommentId)
throw new Exception('Page not found', 1);
}

$fieldData = $targetPage->kommentsInbox()->yaml();
$fieldData = $baseUtils->getAllCommentsOfPage($targetPage);
$fieldData = $fieldData->toArray();
$newFieldData = [];

for ($i = 0; $i < count($fieldData); $i++) {
Expand Down
8 changes: 4 additions & 4 deletions vendor/composer/installed.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<?php return array(
'root' => array(
'name' => 'mauricerenck/komments',
'pretty_version' => '2.0.1',
'version' => '2.0.1.0',
'pretty_version' => '2.0.3',
'version' => '2.0.3.0',
'reference' => NULL,
'type' => 'kirby-plugin',
'install_path' => __DIR__ . '/../../',
Expand All @@ -29,8 +29,8 @@
'dev_requirement' => false,
),
'mauricerenck/komments' => array(
'pretty_version' => '2.0.1',
'version' => '2.0.1.0',
'pretty_version' => '2.0.3',
'version' => '2.0.3.0',
'reference' => NULL,
'type' => 'kirby-plugin',
'install_path' => __DIR__ . '/../../',
Expand Down

0 comments on commit 3bda0f2

Please sign in to comment.