Skip to content

Commit

Permalink
Merge f0998fa into 9ff1db4
Browse files Browse the repository at this point in the history
  • Loading branch information
Cheddam committed Mar 22, 2019
2 parents 9ff1db4 + f0998fa commit 3301a87
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions src/Admin/CommentsGridFieldBulkAction/CommentHandler.php
Expand Up @@ -3,6 +3,7 @@
namespace SilverStripe\Comments\Admin\CommentsGridFieldBulkAction;

use Colymba\BulkManager\BulkAction\Handler;
use Colymba\BulkTools\HTTPBulkToolsResponse;
use SilverStripe\Comments\Model\Comment;
use SilverStripe\Core\Convert;
use SilverStripe\Control\HTTPRequest;
Expand All @@ -22,17 +23,19 @@ public function index(HTTPRequest $request)
{
$ids = [];

$response = new HTTPBulkToolsResponse(
true,
$this->gridField,
200
);

foreach ($this->getRecords() as $comment) {
array_push($ids, $comment->ID);
$this->updateComment($comment);
$response->addSuccessRecord($comment);
}

$response = new HTTPResponse(json_encode([
'done' => true,
'records' => $ids,
]));

$response->addHeader('Content-Type', 'application/json');
$response->setMessage(_t(__CLASS__ . '.CHANGES_APPLIED', 'Changes applied'));

return $response;
}
Expand Down

0 comments on commit 3301a87

Please sign in to comment.