Bartosz Dziewoński has uploaded a new change for review.
https://gerrit.wikimedia.org/r/251192
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(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/VisualEditor
refs/changes/92/251192/1
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: newchange
Gerrit-Change-Id: I7b8e83fa0bf98449e63e67705b709d227d9a379f
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/VisualEditor
Gerrit-Branch: master
Gerrit-Owner: Bartosz Dziewoński <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits