WatchAction: Add 'returnto' and 'returntoquery' to the login link

Bug: 60594
Change-Id: Ic8c0ea5b203c63f9273992cb70bfb06c0d461311
This commit is contained in:
konarak 2014-04-04 14:05:28 +05:30 committed by Bartosz Dziewoński
parent 50f4b6778e
commit 5053348474
3 changed files with 8 additions and 3 deletions

View file

@ -82,7 +82,14 @@ class WatchAction extends FormAction {
protected function checkCanExecute( User $user ) {
// Must be logged in
if ( $user->isAnon() ) {
throw new ErrorPageError( 'watchnologin', 'watchnologintext' );
$loginreqlink = Linker::linkKnown(
SpecialPage::getTitleFor( 'Userlogin' ),
$this->msg( 'loginreqlink' )->escaped(),
array(),
array( 'returnto' => $this->getPageTitle(), 'returntoquery' => 'action=' . $this->getName() )
);
$reasonMsg = $this->msg( 'watchlistanontext' )->rawParams( $loginreqlink );
throw new UserNotLoggedIn( $reasonMsg, 'watchnologin' );
}
return parent::checkCanExecute( $user );

View file

@ -1825,7 +1825,6 @@
"nowatchlist": "You have no items on your watchlist.",
"watchlistanontext": "Please $1 to view or edit items on your watchlist.",
"watchnologin": "Not logged in",
"watchnologintext": "You must be [[Special:UserLogin|logged in]] to modify your watchlist.",
"addwatch": "Add to watchlist",
"addedwatchtext": "The page \"[[:$1]]\" has been added to your [[Special:Watchlist|watchlist]].\nFuture changes to this page and its associated talk page will be listed there.",
"removewatch": "Remove from watchlist",

View file

@ -1851,7 +1851,6 @@
"nowatchlist": "Displayed when there is no pages in the watchlist.",
"watchlistanontext": "Parameters:\n* $1 - a link to [[Special:UserLogin]] with {{msg-mw|loginreqlink}} as link description",
"watchnologin": "Used as error page title.\n\nThe error message for this title is:\n* {{msg-mw|Watchnologintext}}\n{{Identical|Not logged in}}",
"watchnologintext": "Used as error message.\n\nThe title for this error is {{msg-mw|Watchnologin}}.",
"addwatch": "Link to a dialog box, displayed at the end of the list of categories at the foot of each page.\n\nSee also:\n* {{msg-mw|Removewatch}}",
"addedwatchtext": "Explanation shown when clicking on the {{msg-mw|Watch}} tab. Parameters:\n* $1 - page title\nSee also:\n* {{msg-mw|Addedwatch}}",
"removewatch": "Link to a dialog box, displayed at the end of the list of categories at the foot of each page.\n\nSee also:\n* {{msg-mw|Addwatch}}",