Transmit the user who deletes a comment

This commit is contained in:
Johannes Meyer 2020-05-14 13:54:04 +02:00
parent a2009913c9
commit 287edb7932
4 changed files with 8 additions and 3 deletions

View File

@ -94,6 +94,7 @@ class DeleteCommentCommandForm extends CommandForm
{
$cmd = new DeleteCommentCommand();
$cmd
->setAuthor($this->Auth()->getUser()->getUsername())
->setCommentId($this->getElement('comment_id')->getValue())
->setCommentName($this->getElement('comment_name')->getValue())
->setIsService($this->getElement('comment_is_service')->getValue());

View File

@ -73,6 +73,7 @@ class DeleteCommentsCommandForm extends CommandForm
$cmd
->setCommentId($comment->id)
->setCommentName($comment->name)
->setAuthor($this->Auth()->getUser()->getUsername())
->setIsService(isset($comment->service_description));
$this->getTransport($this->request)->send($cmd);
}

View File

@ -10,6 +10,8 @@ use Icinga\Module\Monitoring\Command\IcingaCommand;
*/
class DeleteCommentCommand extends IcingaCommand
{
use CommandAuthor;
/**
* ID of the comment that is to be deleted
*

View File

@ -237,9 +237,10 @@ class IcingaApiCommandRenderer implements IcingaCommandRendererInterface
public function renderDeleteComment(DeleteCommentCommand $command)
{
$endpoint = 'actions/remove-comment';
$data = array(
'comment' => $command->getCommentName()
);
$data = [
'author' => $command->getAuthor(),
'comment' => $command->getCommentName()
];
return IcingaApiCommand::create($endpoint, $data);
}