From: konarak Date: Fri, 4 Apr 2014 08:35:28 +0000 (+0530) Subject: WatchAction: Add 'returnto' and 'returntoquery' to the login link X-Git-Tag: 1.31.0-rc.0~16362^2 X-Git-Url: https://git.cyclocoop.org/%7B%24www_url%7Dadmin/compta/banques/%7B%7B%20url_for%28%27admin_users%27%29%20%7D%7D?a=commitdiff_plain;h=505334847461a691205ba9be04becadfbb97eff1;p=lhc%2Fweb%2Fwiklou.git WatchAction: Add 'returnto' and 'returntoquery' to the login link Bug: 60594 Change-Id: Ic8c0ea5b203c63f9273992cb70bfb06c0d461311 --- diff --git a/includes/actions/WatchAction.php b/includes/actions/WatchAction.php index e1b5d52bfa..2c7502e574 100644 --- a/includes/actions/WatchAction.php +++ b/includes/actions/WatchAction.php @@ -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 ); diff --git a/languages/i18n/en.json b/languages/i18n/en.json index 9031b9678b..5379a7c72d 100644 --- a/languages/i18n/en.json +++ b/languages/i18n/en.json @@ -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", diff --git a/languages/i18n/qqq.json b/languages/i18n/qqq.json index 5b3c939115..dddee1f0c3 100644 --- a/languages/i18n/qqq.json +++ b/languages/i18n/qqq.json @@ -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}}",