public function deleteComment($ID, $TK, $Target = '')
{
$session = Gdn::session();
if (!$session->validateTransientKey($TK)) {
throw permissionException();
}
if (!is_numeric($ID)) {
throw Gdn_UserException('Invalid ID');
}
$comment = $this->ActivityModel->getComment($ID);
if (!$comment) {
throw notFoundException('Comment');
}
$activity = $this->ActivityModel->getID(val('ActivityID', $comment));
if (!$activity) {
throw notFoundException('Activity');
}
if (!$this->ActivityModel->canDelete($activity)) {
throw permissionException();
}
$this->ActivityModel->deleteComment($ID);
if ($this->deliveryType() === DELIVERY_TYPE_ALL) {
redirect($Target);
}
$this->render('Blank', 'Utility', 'Dashboard');
}