FIX Bug with requiring login when posting a comment, pass correct controller in

This commit is contained in:
Robbie Averill 2018-06-20 14:20:50 +12:00
parent 2c00421cd2
commit 886c5be21a

View File

@ -2,6 +2,7 @@
namespace SilverStripe\Comments\Forms; namespace SilverStripe\Comments\Forms;
use SilverStripe\Control\HTTPResponse;
use SilverStripe\Forms\CompositeField; use SilverStripe\Forms\CompositeField;
use SilverStripe\Forms\EmailField; use SilverStripe\Forms\EmailField;
use SilverStripe\Forms\FieldList; use SilverStripe\Forms\FieldList;
@ -192,7 +193,7 @@ class CommentForm extends Form
// If commenting can only be done by logged in users, make sure the user is logged in // If commenting can only be done by logged in users, make sure the user is logged in
if (!$this->controller->getOwnerRecord()->canPostComment()) { if (!$this->controller->getOwnerRecord()->canPostComment()) {
return Security::permissionFailure( return Security::permissionFailure(
$this, $this->controller,
_t( _t(
'SilverStripe\\Comments\\Controllers\\CommentingController.PERMISSIONFAILURE', 'SilverStripe\\Comments\\Controllers\\CommentingController.PERMISSIONFAILURE',
"You're not able to post comments to this page. Please ensure you are logged in and have an " "You're not able to post comments to this page. Please ensure you are logged in and have an "