mirror of
https://github.com/silverstripe/silverstripe-comments
synced 2024-10-22 11:05:49 +02:00
FIX endless redirect while moderating comments
This commit is contained in:
parent
f74b13a2b7
commit
2bcf0ec30e
@ -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);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user