PleaseStand has uploaded a new change for review.
https://gerrit.wikimedia.org/r/179614
Change subject: EditPage: Don't warn if the page already redirects to itself
......................................................................
EditPage: Don't warn if the page already redirects to itself
Also improved the wording of the "selfredirect" message.
Change-Id: I89a4647c03ccc31db4812dedac107869b2721833
---
M includes/EditPage.php
M languages/i18n/en.json
2 files changed, 10 insertions(+), 6 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core
refs/changes/14/179614/1
diff --git a/includes/EditPage.php b/includes/EditPage.php
index 2155c1b..d05b996 100644
--- a/includes/EditPage.php
+++ b/includes/EditPage.php
@@ -1928,11 +1928,15 @@
&& $content->isRedirect()
&& $content->getRedirectTarget()->equals(
$this->getTitle() )
) {
- $this->selfRedirect = true;
- $status->fatal( 'selfredirect' );
- $status->value = self::AS_SELF_REDIRECT;
- wfProfileOut( __METHOD__ );
- return $status;
+ // If the page already redirects to itself, don't warn.
+ $currentTarget =
$this->getCurrentContent()->getRedirectTarget();
+ if ( !$currentTarget || !$currentTarget->equals(
$this->getTitle() ) ) {
+ $this->selfRedirect = true;
+ $status->fatal( 'selfredirect' );
+ $status->value = self::AS_SELF_REDIRECT;
+ wfProfileOut( __METHOD__ );
+ return $status;
+ }
}
// Check for length errors again now that the section is merged
in
diff --git a/languages/i18n/en.json b/languages/i18n/en.json
index 52e3a78..9968403 100644
--- a/languages/i18n/en.json
+++ b/languages/i18n/en.json
@@ -590,7 +590,7 @@
"anoneditwarning": "<strong>Warning:</strong> You are not logged in.
Your IP address will be publicly visible if you make any edits. If you
<strong>[$1 log in]</strong> or <strong>[$2 create an account]</strong>, your
edits will be attributed to your username, along with other benefits.",
"anonpreviewwarning": "<em>You are not logged in. Saving will record
your IP address in this page's edit history.</em>",
"missingsummary": "<strong>Reminder:</strong> You have not provided an
edit summary.\nIf you click \"{{int:savearticle}}\" again, your edit will be
saved without one.",
- "selfredirect": "<strong>Warning:</strong> You are creating redirect to
the same article.\nIf you click \"{{int:savearticle}}\" again, the redirect
will be created.",
+ "selfredirect": "<strong>Warning:</strong> You are redirecting this
page to itself.\nYou may have specified the wrong target for the redirect, or
you may be editing the wrong page.\nIf you click \"{{int:savearticle}}\" again,
the redirect will be created anyway.",
"missingcommenttext": "Please enter a comment below.",
"missingcommentheader": "<strong>Reminder:</strong> You have not
provided a subject/headline for this comment.\nIf you click
\"{{int:savearticle}}\" again, your edit will be saved without one.",
"summary-preview": "Summary preview:",
--
To view, visit https://gerrit.wikimedia.org/r/179614
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I89a4647c03ccc31db4812dedac107869b2721833
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: PleaseStand <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits