jenkins-bot has submitted this change and it was merged.
Change subject: Show a confirmation message on Special:UserRights
......................................................................
Show a confirmation message on Special:UserRights
If the rights was saved, show a Special:Preferences-like success-box on top
of the page, which indicates, that the user rights was saved successfully.
Bug: T103361
Change-Id: I19646e9a1b0b31b4fbfe0fa2c8f775f8a2a67a83
---
M includes/specials/SpecialUserrights.php
M languages/i18n/en.json
M languages/i18n/qqq.json
3 files changed, 24 insertions(+), 8 deletions(-)
Approvals:
Siebrand: Looks good to me, approved
jenkins-bot: Verified
diff --git a/includes/specials/SpecialUserrights.php
b/includes/specials/SpecialUserrights.php
index 1ed392f..a6fe1b5 100644
--- a/includes/specials/SpecialUserrights.php
+++ b/includes/specials/SpecialUserrights.php
@@ -31,6 +31,10 @@
# either a GET parameter or a subpage-style parameter, so have a member
# variable for it.
protected $mTarget;
+ /*
+ * @var null|User $mFetchedUser The user object of the target username
or null.
+ */
+ protected $mFetchedUser = null;
protected $isself = false;
public function __construct() {
@@ -75,6 +79,8 @@
// any groups, it's a bit silly to give them the user search
prompt.
$user = $this->getUser();
+ $request = $this->getRequest();
+ $out = $this->getOutput();
/*
* If the user is blocked and they only have "partial" access
@@ -84,8 +90,6 @@
if ( $user->isBlocked() && !$user->isAllowed( 'userrights' ) ) {
throw new UserBlockedError( $user->getBlock() );
}
-
- $request = $this->getRequest();
if ( $par !== null ) {
$this->mTarget = $par;
@@ -110,13 +114,17 @@
$this->isself = true;
}
+ $fetchedStatus = $this->fetchUser( $this->mTarget );
+ if ( $fetchedStatus->isOk() ) {
+ $this->mFetchedUser = $fetchedStatus->value;
+ }
+
if ( !$this->userCanChangeRights( $user, true ) ) {
if ( $this->isself && $request->getCheck( 'success' ) )
{
// bug 48609: if the user just removed its own
rights, this would
// leads it in a "permissions error" page. In
that case, show a
// message that it can't anymore use this page
instead of an error
$this->setHeaders();
- $out = $this->getOutput();
$out->wrapWikiMsg( "<div
class=\"successbox\">\n$1\n</div>", 'userrights-removed-self' );
$out->returnToMain();
@@ -128,12 +136,19 @@
throw new PermissionsError( null, array( array( $msg )
) );
}
+ // show a successbox, if the user rights was saved successfully
+ if ( $request->getCheck( 'success' ) && $this->mFetchedUser !==
null ) {
+ $out->wrapWikiMsg(
+ "<div class=\"successbox\">\n$1\n</div>",
+ array( 'savedrights',
$this->mFetchedUser->getName() )
+ );
+ }
+
$this->checkReadOnly();
$this->setHeaders();
$this->outputHeader();
- $out = $this->getOutput();
$out->addModuleStyles( 'mediawiki.special' );
$this->addHelpLink( 'Help:Assigning permissions' );
@@ -149,14 +164,13 @@
$user->matchEditToken( $request->getVal( 'wpEditToken'
), $this->mTarget )
) {
// save settings
- $status = $this->fetchUser( $this->mTarget );
- if ( !$status->isOK() ) {
- $this->getOutput()->addWikiText(
$status->getWikiText() );
+ if ( !$fetchedStatus->isOK() ) {
+ $this->getOutput()->addWikiText(
$fetchedStatus->getWikiText() );
return;
}
- $targetUser = $status->value;
+ $targetUser = $this->mFetchedUser;
if ( $targetUser instanceof User ) { // UserRightsProxy
doesn't have this method (bug 61252)
$targetUser->clearInstanceCache(); // bug 38989
}
diff --git a/languages/i18n/en.json b/languages/i18n/en.json
index 8dbf024..8e6ae3d 100644
--- a/languages/i18n/en.json
+++ b/languages/i18n/en.json
@@ -986,6 +986,7 @@
"prefs-help-recentchangescount": "This includes recent changes, page
histories, and logs.",
"prefs-help-watchlist-token2": "This is the secret key to the web feed
of your watchlist.\nAnyone who knows it will be able to read your watchlist, so
do not share it.\nIf you need to, [[Special:ResetTokens|you can reset it]].",
"savedprefs": "Your preferences have been saved.",
+ "savedrights": "The user rights of {{GENDER:$1|$1}} have been saved.",
"timezonelegend": "Time zone:",
"localtime": "Local time:",
"timezoneuseserverdefault": "Use wiki default ($1)",
diff --git a/languages/i18n/qqq.json b/languages/i18n/qqq.json
index bb248bd..a6e9c22 100644
--- a/languages/i18n/qqq.json
+++ b/languages/i18n/qqq.json
@@ -1159,6 +1159,7 @@
"prefs-help-recentchangescount": "Used in [[Special:Preferences]], tab
\"Recent changes\".",
"prefs-help-watchlist-token2": "Used in [[Special:Preferences]], tab
Watchlist. (Formerly in {{msg-mw|prefs-help-watchlist-token}}.)",
"savedprefs": "This message appears after saving changes to your user
preferences.",
+ "savedrights": "This message appears after saving the user rights on
[[Special:UserRights]].\n* $1 - The user name of the user which rights was
saved.",
"timezonelegend": "{{Identical|Time zone}}",
"localtime": "Used as label in
[[Special:Preferences#mw-prefsection-datetime|preferences]].",
"timezoneuseserverdefault": "[[Special:Preferences]] > Date and time >
Time zone\n\nThis option lets your time zone setting use the one that is used
on the wiki (often UTC).\n\nParameters:\n* $1 - timezone name, or timezone
offset (in \"%+03d:%02d\" format)",
--
To view, visit https://gerrit.wikimedia.org/r/244811
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I19646e9a1b0b31b4fbfe0fa2c8f775f8a2a67a83
Gerrit-PatchSet: 4
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Florianschmidtwelzow <[email protected]>
Gerrit-Reviewer: Siebrand <[email protected]>
Gerrit-Reviewer: jenkins-bot <>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits