Don't fetch comments and downtimes twice in an object's detail view

The controller counts comments and downtimes on the object, which will automatically fetch comments and downtimes.
After that came a call to MonitoredObject::populate() which again fetched comments and downtimes.
Now the object is populated before counting comments and dowtimes.

refs #8614
This commit is contained in:
Eric Lippmann 2015-03-11 13:32:54 +01:00
parent b501fef62b
commit 0286641369
1 changed files with 2 additions and 1 deletions

View File

@ -73,6 +73,7 @@ abstract class MonitoredObjectController extends Controller
}
}
}
$this->object->populate();
if (count($this->object->comments) > 0 && $auth->hasPermission('monitoring/command/comment/delete')) {
$delCommentForm = new DeleteCommentCommandForm();
$delCommentForm
@ -93,7 +94,7 @@ abstract class MonitoredObjectController extends Controller
->setObjects($this->object)
->handleRequest();
$this->view->toggleFeaturesForm = $toggleFeaturesForm;
$this->view->object = $this->object->populate();
$this->view->object = $this->object;
}
/**