Bmansurov has uploaded a new change for review.
https://gerrit.wikimedia.org/r/164673
Change subject: Redirect to login
......................................................................
Redirect to login
Bug: 71206
Change-Id: Id804faf6c20b385abecd67c7a1632d19d15d0fe3
---
M includes/specials/SpecialMobileWatchlist.php
M includes/specials/SpecialUploads.php
2 files changed, 8 insertions(+), 52 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/MobileFrontend
refs/changes/73/164673/1
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..c6d71fa 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 a watchlist
+ $this->requireLogin( 'watchlistanontext' );
+
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: newchange
Gerrit-Change-Id: Id804faf6c20b385abecd67c7a1632d19d15d0fe3
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/MobileFrontend
Gerrit-Branch: master
Gerrit-Owner: Bmansurov <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits