Fix deleting content from moderation report page
authorMatthias Schmidt <gravatronics@live.com>
Thu, 6 May 2021 08:06:43 +0000 (10:06 +0200)
committerMatthias Schmidt <gravatronics@live.com>
Thu, 6 May 2021 08:06:43 +0000 (10:06 +0200)
Close WoltLab/com.woltlab.wbb#461

wcfsetup/install/files/lib/data/moderation/queue/ModerationQueueReportAction.class.php

index b66ece5e6d9ef1022915a8df4d91d3822c39f17f..e5866238a16101f23f3cdab4696e8efc9f3d839c 100644 (file)
@@ -36,11 +36,13 @@ class ModerationQueueReportAction extends ModerationQueueAction
     {
         $this->validateRemoveReport();
 
-        if (!ModerationQueueReportManager::getInstance()->canRemoveContent($this->queue->getDecoratedObject())) {
-            throw new PermissionDeniedException();
+        foreach ($this->getObjects() as $moderationQueueEditor) {
+            if (!ModerationQueueReportManager::getInstance()->canRemoveContent($moderationQueueEditor->getDecoratedObject())) {
+                throw new PermissionDeniedException();
+            }
         }
 
-        $this->parameters['message'] = (isset($this->parameters['message']) ? StringUtil::trim($this->parameters['message']) : '');
+        $this->parameters['message'] = isset($this->parameters['message']) ? StringUtil::trim($this->parameters['message']) : '';
     }
 
     /**
@@ -48,13 +50,14 @@ class ModerationQueueReportAction extends ModerationQueueAction
      */
     public function removeContent()
     {
-        // mark content as deleted
-        ModerationQueueReportManager::getInstance()->removeContent(
-            $this->queue->getDecoratedObject(),
-            $this->parameters['message']
-        );
+        foreach ($this->getObjects() as $moderationQueueEditor) {
+            ModerationQueueReportManager::getInstance()->removeContent(
+                $moderationQueueEditor->getDecoratedObject(),
+                $this->parameters['message']
+            );
 
-        $this->queue->markAsConfirmed();
+            $moderationQueueEditor->markAsConfirmed();
+        }
 
         $this->unmarkItems();
     }