mirror of
https://github.com/Icinga/icingaweb2.git
synced 2025-07-30 01:04:09 +02:00
monitoring: Fix HTTP response code when showing an invalid comment
refs #6281
This commit is contained in:
parent
3f608fda24
commit
e137263c4b
@ -20,13 +20,11 @@ class Monitoring_CommentController extends Controller
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Fetch the first comment with the given id and add tabs
|
* Fetch the first comment with the given id and add tabs
|
||||||
*
|
|
||||||
* @throws Zend_Controller_Action_Exception
|
|
||||||
*/
|
*/
|
||||||
public function init()
|
public function init()
|
||||||
{
|
{
|
||||||
$commentId = $this->params->get('comment_id');
|
$commentId = $this->params->getRequired('comment_id');
|
||||||
|
|
||||||
$this->comment = $this->backend->select()->from('comment', array(
|
$this->comment = $this->backend->select()->from('comment', array(
|
||||||
'id' => 'comment_internal_id',
|
'id' => 'comment_internal_id',
|
||||||
'objecttype' => 'comment_objecttype',
|
'objecttype' => 'comment_objecttype',
|
||||||
@ -41,9 +39,9 @@ class Monitoring_CommentController extends Controller
|
|||||||
'host_display_name',
|
'host_display_name',
|
||||||
'service_display_name'
|
'service_display_name'
|
||||||
))->where('comment_internal_id', $commentId)->getQuery()->fetchRow();
|
))->where('comment_internal_id', $commentId)->getQuery()->fetchRow();
|
||||||
|
|
||||||
if (false === $this->comment) {
|
if ($this->comment === false) {
|
||||||
throw new Zend_Controller_Action_Exception($this->translate('Comment not found'));
|
$this->httpNotFound($this->translate('Comment not found'));
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->getTabs()->add(
|
$this->getTabs()->add(
|
||||||
@ -88,7 +86,7 @@ class Monitoring_CommentController extends Controller
|
|||||||
private function createDelCommentForm()
|
private function createDelCommentForm()
|
||||||
{
|
{
|
||||||
$this->assertPermission('monitoring/command/comment/delete');
|
$this->assertPermission('monitoring/command/comment/delete');
|
||||||
|
|
||||||
$delCommentForm = new DeleteCommentCommandForm();
|
$delCommentForm = new DeleteCommentCommandForm();
|
||||||
$delCommentForm->setAction(
|
$delCommentForm->setAction(
|
||||||
Url::fromPath('monitoring/comment/show')
|
Url::fromPath('monitoring/comment/show')
|
||||||
|
@ -30,8 +30,6 @@ class Monitoring_DowntimeController extends Controller
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Fetch the downtime matching the given id and add tabs
|
* Fetch the downtime matching the given id and add tabs
|
||||||
*
|
|
||||||
* @throws Zend_Controller_Action_Exception
|
|
||||||
*/
|
*/
|
||||||
public function init()
|
public function init()
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user