FIX endless redirect while moderating comments

This commit is contained in:
Juan van den Anker 2017-06-02 10:47:49 +12:00
parent f74b13a2b7
commit 2bcf0ec30e

View File

@ -263,7 +263,17 @@ class CommentingController extends Controller
return $this->httpError(400);
}
if (!$comment->Moderated) {
$comment->markSpam();
}
// prevent endless loop of redirects if this request has been made without being logged on
$referer = $this->request->getHeader('Referer');
if (strpos($referer,"/Security/login") !== false) {
echo "Comment marked as spam";
return ;
}
return $this->renderChangedCommentState($comment);
}
@ -283,7 +293,17 @@ class CommentingController extends Controller
return $this->httpError(400);
}
if (!$comment->Moderated) {
$comment->markApproved();
}
// prevent endless loop of redirects if this request has been made without being logged on
$referer = $this->request->getHeader('Referer');
if (strpos($referer,"/Security/login") !== false) {
echo "Comment approved";
return ;
}
return $this->renderChangedCommentState($comment);
}
@ -303,7 +323,17 @@ class CommentingController extends Controller
return $this->httpError(400);
}
if (!$comment->Moderated) {
$comment->markApproved();
}
// prevent endless loop of redirects if this request has been made without being logged on
$referer = $this->request->getHeader('Referer');
if (strpos($referer,"/Security/login") !== false) {
echo "Comment approved";
return ;
}
return $this->renderChangedCommentState($comment);
}