jenkins-bot has submitted this change and it was merged.

Change subject: ApiVisualEditor: Return the correct notice when user is not 
allowed to create page
......................................................................


ApiVisualEditor: Return the correct notice when user is not allowed to create 
page

'nocreatetext' is only the right error message when anonymous users
are generally not allowed to create pages on the wiki. But there are
other situations, for example a title might be blacklisted.

Change-Id: I7b8e83fa0bf98449e63e67705b709d227d9a379f
---
M ApiVisualEditor.php
1 file changed, 3 insertions(+), 2 deletions(-)

Approvals:
  Alex Monk: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/ApiVisualEditor.php b/ApiVisualEditor.php
index b0e3388..366c268 100644
--- a/ApiVisualEditor.php
+++ b/ApiVisualEditor.php
@@ -430,10 +430,11 @@
                                }
 
                                // Permission notice
-                               if ( !$title->userCan( 'create' ) && 
!$title->exists() ) {
+                               $permErrors = $title->getUserPermissionsErrors( 
'create', $user );
+                               if ( $permErrors && !$title->exists() ) {
                                        $notices[] = $this->msg(
                                                
'permissionserrorstext-withaction', 1, $this->msg( 'action-createpage' )
-                                       ) . "<br>" . $this->msg( 'nocreatetext' 
)->parse();
+                                       ) . "<br>" . call_user_func_array( 
array( $this, 'msg' ), $permErrors[0] )->parse();
                                }
 
                                // Show notice when editing user / user talk 
page of a user that doesn't exist

-- 
To view, visit https://gerrit.wikimedia.org/r/251192
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I7b8e83fa0bf98449e63e67705b709d227d9a379f
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/VisualEditor
Gerrit-Branch: master
Gerrit-Owner: Bartosz DziewoƄski <[email protected]>
Gerrit-Reviewer: Alex Monk <[email protected]>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to