Fix redirects after deleting a comment

refs #8624
This commit is contained in:
Matthias Jentsch 2015-05-07 17:02:34 +02:00
parent 1fa550838d
commit c6c78989a5
2 changed files with 11 additions and 6 deletions

View File

@ -64,12 +64,15 @@ class Monitoring_CommentController extends Controller
*/
public function showAction()
{
$listCommentsLink = Url::fromPath('monitoring/list/comments')
->setQueryString('comment_type=(comment|ack)');
$this->view->comment = $this->comment;
if ($this->hasPermission('monitoring/command/comment/delete')) {
$this->view->delCommentForm = $this->createDelCommentForm();
$this->view->delCommentForm->populate(
array(
'redirect' => Url::fromPath('monitoring/list/comments'),
'redirect' => $listCommentsLink,
'comment_id' => $this->comment->id,
'comment_is_service' => isset($this->comment->service_description)
)

View File

@ -81,9 +81,8 @@ class Monitoring_CommentsController extends Controller
{
$this->assertPermission('monitoring/command/comment/delete');
$this->view->comments = $this->comments;
$this->view->listAllLink = Url::fromPath('monitoring/list/comments')
->setQueryString($this->filter->toQueryString());
$listCommentsLink = Url::fromPath('monitoring/list/comments')
->setQueryString('comment_type=(comment|ack)');
$delCommentForm = new DeleteCommentsCommandForm();
$delCommentForm->setTitle($this->view->translate('Remove all Comments'));
$delCommentForm->addDescription(sprintf(
@ -91,8 +90,11 @@ class Monitoring_CommentsController extends Controller
count($this->comments)
));
$delCommentForm->setComments($this->comments)
->setRedirectUrl(Url::fromPath('monitoring/list/comments'))
->handleRequest();
->setRedirectUrl($listCommentsLink)
->handleRequest();
$this->view->delCommentForm = $delCommentForm;
$this->view->comments = $this->comments;
$this->view->listAllLink = Url::fromPath('monitoring/list/comments')
->setQueryString($this->filter->toQueryString());
}
}