jenkins-bot has submitted this change and it was merged.
Change subject: Redirect to login
......................................................................
Redirect to login
Bug: 71206
Change-Id: Id804faf6c20b385abecd67c7a1632d19d15d0fe3
---
M MobileFrontend.php
M i18n/en.json
M i18n/qqq.json
M includes/specials/SpecialMobileEditWatchlist.php
M includes/specials/SpecialMobileWatchlist.php
M includes/specials/SpecialUploads.php
6 files changed, 20 insertions(+), 63 deletions(-)
Approvals:
Jdlrobson: Looks good to me, approved
jenkins-bot: Verified
diff --git a/MobileFrontend.php b/MobileFrontend.php
index 736024e..313ad8a 100644
--- a/MobileFrontend.php
+++ b/MobileFrontend.php
@@ -196,6 +196,11 @@
'wgMFThumbnailMedium' => MobilePage::MEDIUM_IMAGE_WIDTH
. 'px',
)
);
+ // FIXME: move out of this file. See bug 71769.
+ array_push(
+ LoginForm::$validErrorMessages,
+ 'mobile-frontend-donate-image-anon'
+ );
}
// ResourceLoader modules
diff --git a/i18n/en.json b/i18n/en.json
index 157a356..8ad7700 100644
--- a/i18n/en.json
+++ b/i18n/en.json
@@ -31,7 +31,7 @@
"mobile-frontend-diffview-title": "Changes",
"mobile-frontend-disable-images": "Disable images on mobile site",
"mobile-frontend-dismiss-notification": "dismiss this notification",
- "mobile-frontend-donate-image-anon": "A $1 is required to view the
uploads page.",
+ "mobile-frontend-donate-image-anon": "Please log in to view the uploads
page.",
"mobile-frontend-donate-image-heading": "Your recent contributions",
"mobile-frontend-donate-image-login": "Media on {{SITENAME}} is donated
by people like you.",
"mobile-frontend-donate-image-login-action": "Log in to share your
media.",
diff --git a/i18n/qqq.json b/i18n/qqq.json
index 8fce385..62154e7 100644
--- a/i18n/qqq.json
+++ b/i18n/qqq.json
@@ -58,7 +58,7 @@
"mobile-frontend-diffview-title": "Header for common mobile diff/change
view. Parameters:\n* $1 - (Optional) page title (for backwards
compatibility)\n{{Identical|Change}}",
"mobile-frontend-disable-images": "Unused at this time.\n\nSee also:\n*
{{msg-mw|Mobile-frontend-enable-images}}",
"mobile-frontend-dismiss-notification": "Phrase used to dismiss the top
banner notification",
- "mobile-frontend-donate-image-anon": "Message shown to user who visits
the [[Special:Uploads]] page without a user account.\n\nParameters:\n* $1 -
link to the user login page. Its link text is
{{msg-mw|mobile-frontend-user-account}}.\n{{Related|Mobile-frontend-login}}",
+ "mobile-frontend-donate-image-anon": "Message shown to user who visits
the [[Special:Uploads]] page without a user
account.\n\n{{Related|Mobile-frontend-login}}",
"mobile-frontend-donate-image-heading": "heading for a list of recent
contributions",
"mobile-frontend-donate-image-login": "Title for [[Special:UserLogin]]
when being redirected to [[Special:Uploads]].\n\nUsed when the user is not
logged in.\n{{Related|Mobile-frontend-login}}",
"mobile-frontend-donate-image-login-action": "Call to action to login
to donate images.",
diff --git a/includes/specials/SpecialMobileEditWatchlist.php
b/includes/specials/SpecialMobileEditWatchlist.php
index 6af62c3..6fd2593 100644
--- a/includes/specials/SpecialMobileEditWatchlist.php
+++ b/includes/specials/SpecialMobileEditWatchlist.php
@@ -49,18 +49,14 @@
}
public function execute( $par ) {
+ // Anons don't get a watchlist edit
+ $this->requireLogin( 'watchlistanontext' );
+
$out = $this->getOutput();
// turn off #content element
$out->setProperty( 'unstyledContent', true );
- if( $this->getUser()->isAnon() ) {
- // No watchlist for you.
- $out->setPageTitle( $this->msg( 'watchnologin' ) );
- $out->setRobotPolicy( 'noindex,nofollow' );
- $out->addHTML(
SpecialMobileWatchlist::getAnonBannerHtml( $this->getPageTitle() ) );
- } else {
- parent::execute( $par );
- $out->setPageTitle( $this->msg( 'watchlist' ) );
- }
+ parent::execute( $par );
+ $out->setPageTitle( $this->msg( 'watchlist' ) );
}
protected function executeViewEditWatchlist() {
diff --git a/includes/specials/SpecialMobileWatchlist.php
b/includes/specials/SpecialMobileWatchlist.php
index 96a7bac..5832cdb 100644
--- a/includes/specials/SpecialMobileWatchlist.php
+++ b/includes/specials/SpecialMobileWatchlist.php
@@ -34,35 +34,6 @@
/** @var Title $fromPageTitle Saves the Title object of the page list
starts from */
private $fromPageTitle;
- /**
- * Render an information box, that the anonymous user must login to see
- * his Watchlist
- */
- protected function renderAnonBanner() {
- $out = $this->getOutput();
- $out->setPageTitle( $this->msg( 'watchnologin' ) );
- $out->setRobotPolicy( 'noindex,nofollow' );
- $out->addHTML(
- self::getAnonBannerHtml( $this->getPageTitle() )
- );
- }
-
- /**
- * Get HTML representing a banner prompting you to login.
- * @param Title $pageTitle
- * @return string html
- */
- public static function getAnonBannerHtml( $pageTitle ) {
- $link = Linker::linkKnown(
- SpecialPage::getTitleFor( 'Userlogin' ),
- wfMessage( 'loginreqlink' )->escaped(),
- array(),
- array( 'returnto' => $pageTitle->getPrefixedText() )
- );
- return Html::openElement( 'div', array( 'class' => 'alert
warning' ) ) .
- wfMessage( 'watchlistanontext' )->rawParams( $link
)->parse() .
- Html::closeElement( 'div' );
- }
/**
* Saves a user preference that reflects the current state of the
watchlist
@@ -82,6 +53,9 @@
* @param string $par parameter submitted as subpage
*/
function executeWhenAvailable( $par ) {
+ // Anons don't get a watchlist
+ $this->requireLogin( 'watchlistanontext' );
+
wfProfileIn( __METHOD__ );
$ctx = MobileContext::singleton();
$this->usePageImages = !$ctx->imagesDisabled() && defined(
'PAGE_IMAGES_INSTALLED' );
@@ -95,13 +69,6 @@
$this->fromPageTitle = Title::newFromText( $req->getVal(
'from', false ) );
$output->setPageTitle( $this->msg( 'watchlist' ) );
-
- if( $user->isAnon() ) {
- // No watchlist for you.
- $this->renderAnonBanner();
- wfProfileOut( __METHOD__ );
- return;
- }
// This needs to be done before calling getWatchlistHeader
$this->updateStickyTabs();
diff --git a/includes/specials/SpecialUploads.php
b/includes/specials/SpecialUploads.php
index d67d8d5..efb9afb 100644
--- a/includes/specials/SpecialUploads.php
+++ b/includes/specials/SpecialUploads.php
@@ -19,6 +19,9 @@
* @param string|null $par Username to get uploads from
*/
public function executeWhenAvailable( $par = '' ) {
+ // Anons don't get to see this page
+ $this->requireLogin( 'mobile-frontend-donate-image-anon' );
+
global $wgMFPhotoUploadEndpoint;
$this->setHeaders();
@@ -38,22 +41,8 @@
}
} else {
$user = $this->getUser();
- if ( $user->isAnon() ) {
- // Should show current user's uploads, but
they're not registered
- $returnTo =
$this->getPageTitle()->getPrefixedText();
- $loginLink = Linker::link(
- SpecialPage::getTitleFor( 'Userlogin' ),
- wfMessage(
'mobile-frontend-user-account' )->plain(),
- array(),
- array( 'returnto' => $returnTo )
- );
- $html = '<div class="alert error">' .
- $this->msg(
'mobile-frontend-donate-image-anon' )->rawParams( $loginLink )->parse() .
- '</div>';
- } else {
- // TODO: what if the user cannot upload to the
destination wiki in $wgMFPhotoUploadEndpoint?
- $html = $this->getUserUploadsPageHtml( $user );
- }
+ // TODO: what if the user cannot upload to the
destination wiki in $wgMFPhotoUploadEndpoint?
+ $html = $this->getUserUploadsPageHtml( $user );
}
$output->addHTML( $html );
}
--
To view, visit https://gerrit.wikimedia.org/r/164673
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: Id804faf6c20b385abecd67c7a1632d19d15d0fe3
Gerrit-PatchSet: 8
Gerrit-Project: mediawiki/extensions/MobileFrontend
Gerrit-Branch: master
Gerrit-Owner: Bmansurov <[email protected]>
Gerrit-Reviewer: Awjrichards <[email protected]>
Gerrit-Reviewer: Bmansurov <[email protected]>
Gerrit-Reviewer: Florianschmidtwelzow <[email protected]>
Gerrit-Reviewer: JGonera <[email protected]>
Gerrit-Reviewer: Jdlrobson <[email protected]>
Gerrit-Reviewer: jenkins-bot <>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits