jenkins-bot has submitted this change and it was merged. ( 
https://gerrit.wikimedia.org/r/394860 )

Change subject: Move links from i18n to software
......................................................................


Move links from i18n to software

Bug: T59181
Change-Id: I46de236687020d1af64571738cce236c1fdaafa6
---
M api/MWOAuthSessionProvider.php
M backend/MWOAuthDataStore.php
M backend/MWOAuthServer.php
M frontend/specialpages/SpecialMWOAuth.php
M i18n/en.json
M i18n/qqq.json
6 files changed, 97 insertions(+), 27 deletions(-)

Approvals:
  Gergő Tisza: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/api/MWOAuthSessionProvider.php b/api/MWOAuthSessionProvider.php
index f5cb4bf..f821e65 100644
--- a/api/MWOAuthSessionProvider.php
+++ b/api/MWOAuthSessionProvider.php
@@ -98,7 +98,13 @@
                // There exists a local user
                $localUser = MWOAuthUtils::getLocalUserFromCentralId( 
$access->get( 'userId' ) );
                if ( !$localUser || !$localUser->isLoggedIn() ) {
-                       return $this->makeException( 
'mwoauth-invalid-authorization-invalid-user' );
+                       return $this->makeException( 
'mwoauth-invalid-authorization-invalid-user',
+                               \Message::rawParam( \Linker::makeExternalLink(
+                                       
'https://www.mediawiki.org/wiki/Help:OAuth/Errors#E008',
+                                       'E008',
+                                       true
+                               ) )
+                       );
                }
                if ( $localUser->isLocked() ||
                        ( $this->config->get( 'BlockDisablesLogin' ) && 
$localUser->isBlocked() )
diff --git a/backend/MWOAuthDataStore.php b/backend/MWOAuthDataStore.php
index 02fbe00..7e01bdf 100644
--- a/backend/MWOAuthDataStore.php
+++ b/backend/MWOAuthDataStore.php
@@ -66,7 +66,13 @@
                                throw new MWOAuthException( 
'mwoauthdatastore-request-token-already-used' );
                        }
                        if ( $token === null || !( $returnToken instanceof 
MWOAuthToken ) ) {
-                               throw new MWOAuthException( 
'mwoauthdatastore-request-token-not-found' );
+                               throw new MWOAuthException( 
'mwoauthdatastore-request-token-not-found', [
+                                       \Message::rawParam( 
\Linker::makeExternalLink(
+                                               
'https://www.mediawiki.org/wiki/Help:OAuth/Errors#E004',
+                                               'E004',
+                                               true
+                                       ) )
+                               ] );
                        }
                } elseif ( $token_type === 'access' ) {
                        $cmra = MWOAuthConsumerAcceptance::newFromToken( 
$this->centralSlave, $token );
diff --git a/backend/MWOAuthServer.php b/backend/MWOAuthServer.php
index 4905e29..1d60c33 100644
--- a/backend/MWOAuthServer.php
+++ b/backend/MWOAuthServer.php
@@ -277,11 +277,23 @@
 
                // Check that user and consumer are in good standing
                if ( $mwUser->isLocked() || $wgBlockDisablesLogin && 
$mwUser->isBlocked() ) {
-                       throw new MWOAuthException( 
'mwoauthserver-insufficient-rights' );
+                       throw new MWOAuthException( 
'mwoauthserver-insufficient-rights', [
+                               \Message::rawParam( \Linker::makeExternalLink(
+                                       
'https://www.mediawiki.org/wiki/Help:OAuth/Errors#E007',
+                                       'E007',
+                                       true
+                               ) )
+                       ] );
                }
                $consumer = $this->data_store->lookup_consumer( $consumerKey );
                if ( !$consumer || $consumer->get( 'deleted' ) ) {
-                       throw new MWOAuthException( 
'mwoauthserver-bad-consumer-key' );
+                       throw new MWOAuthException( 
'mwoauthserver-bad-consumer-key', [
+                               \Message::rawParam( \Linker::makeExternalLink(
+                                       
'https://www.mediawiki.org/wiki/Help:OAuth/Errors#E006',
+                                       'E006',
+                                       true
+                               ) )
+                       ] );
                } elseif ( !$consumer->isUsableBy( $mwUser ) ) {
                        $owner = MWOAuthUtils::getCentralUserNameFromId(
                                $consumer->get( 'userId' ),
@@ -289,7 +301,13 @@
                        );
                        throw new MWOAuthException(
                                'mwoauthserver-bad-consumer',
-                               [ $consumer->get( 'name' ), 
MWOAuthUtils::getCentralUserTalk( $owner ) ]
+                               [ $consumer->get( 'name' ), 
MWOAuthUtils::getCentralUserTalk( $owner ), \Message::rawParam(
+                                       \Linker::makeExternalLink(
+                                               
'https://www.mediawiki.org/wiki/Help:OAuth/Errors#E005',
+                                               'E005',
+                                               true
+                                       )
+                               ) ]
                        );
                } elseif ( $consumer->get( 'ownerOnly' ) ) {
                        throw new MWOAuthException( 
'mwoauthserver-consumer-owner-only', [
@@ -317,7 +335,13 @@
                $centralUserId = MWOAuthUtils::getCentralIdFromLocalUser( 
$mwUser );
                if ( !$centralUserId ) {
                        $userMsg = MWOAuthUtils::getSiteMessage( 
'mwoauthserver-invalid-user' );
-                       throw new MWOAuthException( $userMsg, [ $consumer->get( 
'name' ) ] );
+                       throw new MWOAuthException( $userMsg, [ $consumer->get( 
'name' ), \Message::rawParam(
+                               \Linker::makeExternalLink(
+                                       
'https://www.mediawiki.org/wiki/Help:OAuth/Errors#E008',
+                                       'E008',
+                                       true
+                               )
+                       ) ] );
                }
 
                // Authorization Token
@@ -390,7 +414,13 @@
                $centralUserId = MWOAuthUtils::getCentralIdFromLocalUser( 
$mwUser );
                if ( !$centralUserId ) {
                        $userMsg = MWOAuthUtils::getSiteMessage( 
'mwoauthserver-invalid-user' );
-                       throw new MWOAuthException( $userMsg, [ $consumer->get( 
'name' ) ] );
+                       throw new MWOAuthException( $userMsg, [ $consumer->get( 
'name' ), \Message::rawParam(
+                               \Linker::makeExternalLink(
+                                       
'https://www.mediawiki.org/wiki/Help:OAuth/Errors#E008',
+                                       'E008',
+                                       true
+                               )
+                       ) ] );
                }
 
                $checkWiki = $consumer->get( 'wiki' ) !== '*' ? $consumer->get( 
'wiki' ) : $wikiId;
diff --git a/frontend/specialpages/SpecialMWOAuth.php 
b/frontend/specialpages/SpecialMWOAuth.php
index e36708f..1d2e414 100644
--- a/frontend/specialpages/SpecialMWOAuth.php
+++ b/frontend/specialpages/SpecialMWOAuth.php
@@ -132,7 +132,13 @@
                                        $verifier = $request->getVal( 
'oauth_verifier', false );
                                        $requestToken = $request->getVal( 
'oauth_token', false );
                                        if ( !$verifier || !$requestToken ) {
-                                               throw new MWOAuthException( 
'mwoauth-bad-request-missing-params' );
+                                               throw new MWOAuthException( 
'mwoauth-bad-request-missing-params', [
+                                                       \Message::rawParam( 
\Linker::makeExternalLink(
+                                                               
'https://www.mediawiki.org/wiki/Help:OAuth/Errors#E001',
+                                                               'E001',
+                                                               true
+                                                       ) )
+                                               ] );
                                        }
                                        $this->getOutput()->addSubtitle( 
$this->msg( 'mwoauth-desc' )->escaped() );
                                        $this->showResponse(
@@ -162,7 +168,13 @@
                                        $access = 
MWOAuthConsumerAcceptance::newFromToken( $dbr, $token->key );
                                        $localUser = 
MWOAuthUtils::getLocalUserFromCentralId( $access->get( 'userId' ) );
                                        if ( !$localUser || 
!$localUser->isLoggedIn() ) {
-                                               throw new MWOAuthException( 
'mwoauth-invalid-authorization-invalid-user' );
+                                               throw new MWOAuthException( 
'mwoauth-invalid-authorization-invalid-user', [
+                                                       \Message::rawParam( 
\Linker::makeExternalLink(
+                                                               
'https://www.mediawiki.org/wiki/Help:OAuth/Errors#E008',
+                                                               'E008',
+                                                               true
+                                                       ) )
+                                               ] );
                                        } elseif ( $localUser->isLocked() ||
                                                $wgBlockDisablesLogin && 
$localUser->isBlocked()
                                        ) {
@@ -195,7 +207,13 @@
 
                                        if ( !$cmr ) {
                                                $this->showError(
-                                                       wfMessage( 
'mwoauth-bad-request-invalid-action' ),
+                                                       wfMessage( 
'mwoauth-bad-request-invalid-action',
+                                                               
\Linked::makeExternalLink(
+                                                                       
'https://www.mediawiki.org/wiki/Help:OAuth/Errors#E002',
+                                                                       'E002',
+                                                                       true
+                                                               )
+                                                       ),
                                                        $format
                                                );
                                        } else {
@@ -204,7 +222,11 @@
                                                $this->showError(
                                                        wfMessage( 
'mwoauth-bad-request-invalid-action-contact',
                                                                
MWOAuthUtils::getCentralUserTalk( $owner )
-                                                       ),
+                                                       )->rawParams( 
\Linker::makeExternalLink(
+                                                               
'https://www.mediawiki.org/wiki/Help:OAuth/Errors#E003',
+                                                               'E003',
+                                                               true
+                                                       ) ),
                                                        $format
                                                );
                                        }
@@ -318,7 +340,13 @@
                        $this->getContext()
                );
                if ( !$cmr ) {
-                       throw new MWOAuthException( 
'mwoauthserver-bad-consumer-key' );
+                       throw new MWOAuthException( 
'mwoauthserver-bad-consumer-key', [
+                               \Message::rawParam( \Linker::makeExternalLink(
+                                       
'https://www.mediawiki.org/wiki/Help:OAuth/Errors#E006',
+                                       'E006',
+                                       true
+                               ) )
+                       ] );
                } elseif ( !$cmr->getDAO()->isUsableBy( $user ) ) {
                        throw new MWOAuthException(
                                'mwoauthserver-bad-consumer',
diff --git a/i18n/en.json b/i18n/en.json
index d8ead7e..0b76e90 100644
--- a/i18n/en.json
+++ b/i18n/en.json
@@ -193,11 +193,11 @@
        "logentry-mwoauthconsumer-create-owner-only": "$1 {{GENDER:$2|created}} 
an owner-only OAuth consumer (consumer key $4)",
        "mwoauthconsumer-consumer-logpage": "OAuth consumer log",
        "mwoauthconsumer-consumer-logpagetext": "Log of approvals, rejections, 
and disabling of registered OAuth consumers.",
-       "mwoauth-bad-request-missing-params": "Sorry, something went wrong 
configuring this connected application. <span 
class=\"plainlinks\">[https://www.mediawiki.org/wiki/Special:MyLanguage/Help:OAuth
 Contact support]</span> to get help fixing it.\n\n<span class=\"plainlinks 
mw-mwoautherror-details\">OAuth missing parameters, 
[https://www.mediawiki.org/wiki/Help:OAuth/Errors#E001 E001]</span>",
-       "mwoauth-bad-request-invalid-action": "Sorry, something went wrong, 
you'll need to contact the application author for help with this.\n\n<span 
class=\"plainlinks mw-mwoautherror-details\">Unknown URL, 
[https://www.mediawiki.org/wiki/Help:OAuth/Errors#E002 E002]</span>",
-       "mwoauth-bad-request-invalid-action-contact": "Sorry, something went 
wrong. You'll need to [$1 contact] the application author for help with 
this.\n\n<span class=\"plainlinks mw-mwoautherror-details\">Unknown URL, 
[https://www.mediawiki.org/wiki/Help:OAuth/Errors#E003 E003]</span>",
+       "mwoauth-bad-request-missing-params": "Sorry, something went wrong 
configuring this connected application. Contact the application's 
developer.\n\n<span class=\"plainlinks mw-mwoautherror-details\">OAuth missing 
parameters, $1</span>",
+       "mwoauth-bad-request-invalid-action": "Sorry, something went wrong, 
you'll need to contact the application author for help with this.\n\n<span 
class=\"plainlinks mw-mwoautherror-details\">Unknown URL, $1</span>",
+       "mwoauth-bad-request-invalid-action-contact": "Sorry, something went 
wrong. You'll need to [$1 contact] the application author for help with 
this.\n\n<span class=\"plainlinks mw-mwoautherror-details\">Unknown URL, 
$2</span>",
        "mwoauthdatastore-access-token-not-found": "No approved grant was found 
for that authorization token.",
-       "mwoauthdatastore-request-token-not-found": "Sorry, something went 
wrong connecting this application.\nGo back and try to connect your account 
again, or contact the application author.\n\n<span class=\"plainlinks 
mw-mwoautherror-details\">OAuth token not found, 
[https://www.mediawiki.org/wiki/Help:OAuth/Errors#E004 E004]</span>",
+       "mwoauthdatastore-request-token-not-found": "Sorry, something went 
wrong connecting this application.\nGo back and try to connect your account 
again, or contact the application author.\n\n<span class=\"plainlinks 
mw-mwoautherror-details\">OAuth token not found, $1</span>",
        "mwoauthdatastore-callback-not-found": "OAuth callback URL not found in 
cache. This is probably an error in how the application makes requests to the 
server.",
        "mwoauthdatastore-request-token-already-used": "This request has 
already been completed and cannot be resubmitted.\nGo back to the application 
and try to connect your account again, or contact the application 
author.\n\n<span class=\"plainlinks mw-mwoautherror-details\">OAuth token 
already used, [https://www.mediawiki.org/wiki/Help:OAuth/Errors#E009 
E009]</span>",
        "mwoauthdatastore-bad-token": "No token was found matching your 
request.",
@@ -205,11 +205,11 @@
        "mwoauthdatastore-bad-verifier": "The verification code provided was 
not valid.",
        "mwoauthdatastore-invalid-token-type": "The requested token type is 
invalid.",
        "mwoauthgrants-general-error": "There was an error in your OAuth 
request.",
-       "mwoauthserver-bad-consumer": "\"$1\" is not approved as a Connected 
App. [$2 Contact] the application author for help.\n\n<span class=\"plainlinks 
mw-mwoautherror-details\">Connected OAuth app not approved, 
[https://www.mediawiki.org/wiki/Help:OAuth/Errors#E005 E005]</span>",
-       "mwoauthserver-bad-consumer-key": "Sorry, something went wrong 
connecting this application.\n\n<span class=\"plainlinks 
mw-mwoautherror-details\">Unknown OAuth key, 
[https://www.mediawiki.org/wiki/Help:OAuth/Errors#E006 E006]</span>",
-       "mwoauthserver-insufficient-rights": "Your account is not allowed to 
use Connected Apps, contact your site administrator to find out why.\n\n<span 
class=\"plainlinks mw-mwoautherror-details\">Insufficient OAuth user rights, 
[https://www.mediawiki.org/wiki/Help:OAuth/Errors#E007 E007]</span>",
+       "mwoauthserver-bad-consumer": "\"$1\" is not approved as a Connected 
App. [$2 Contact] the application author for help.\n\n<span class=\"plainlinks 
mw-mwoautherror-details\">Connected OAuth app not approved, $3</span>",
+       "mwoauthserver-bad-consumer-key": "Sorry, something went wrong 
connecting this application.\n\n<span class=\"plainlinks 
mw-mwoautherror-details\">Unknown OAuth key, $1</span>",
+       "mwoauthserver-insufficient-rights": "Your account is not allowed to 
use Connected Apps, contact your site administrator to find out why.\n\n<span 
class=\"plainlinks mw-mwoautherror-details\">Insufficient OAuth user rights, 
$1</span>",
        "mwoauthserver-invalid-request-token": "Invalid token in your request.",
-       "mwoauthserver-invalid-user": "To use Connected Apps on this site, you 
must have an account across all projects. When you have an account on all 
projects, you can try to connect \"$1\" again.\n\n<span class=\"plainlinks 
mw-mwoautherror-details\">Unified login needed, 
[https://www.mediawiki.org/wiki/Help:OAuth/Errors#E008 E008]</span>",
+       "mwoauthserver-invalid-user": "To use Connected Apps on this site, you 
must have an account across all projects. When you have an account on all 
projects, you can try to connect \"$1\" again.\n\n<span class=\"plainlinks 
mw-mwoautherror-details\">Unified login needed, $2</span>",
        "mwoauthserver-consumer-no-secret": "Sorry, something went wrong 
connecting this application.\n\n<span class=\"plainlinks 
mw-mwoautherror-details\">Consumer has no secret key, 
[https://www.mediawiki.org/wiki/Help:OAuth/Errors#E009 E009]</span>",
        "mwoauthserver-consumer-owner-only": "\"$1\" is an owner-only Connected 
App. To fetch the access token, see [[$2]].\n\n<span class=\"plainlinks 
mw-mwoautherror-details\">Consumer is owner-only, 
[https://www.mediawiki.org/wiki/Help:OAuth/Errors#E010 E010]</span>",
        "mwoauth-invalid-authorization-title": "OAuth authorization error",
diff --git a/i18n/qqq.json b/i18n/qqq.json
index c6a5d57..621a818 100644
--- a/i18n/qqq.json
+++ b/i18n/qqq.json
@@ -203,11 +203,11 @@
        "logentry-mwoauthconsumer-create-owner-only": "{{logentry}}\n* $4 - 
consumer key",
        "mwoauthconsumer-consumer-logpage": "{{doc-logpage}}",
        "mwoauthconsumer-consumer-logpagetext": "Description of the OAuth 
consumer log.",
-       "mwoauth-bad-request-missing-params": "Error message when MediaWiki 
makes an error during the authorization process, and fails to send all the 
required url parameters",
-       "mwoauth-bad-request-invalid-action": "Error, when the 3rd-party OAuth 
developers sends users to a bad authorization url",
-       "mwoauth-bad-request-invalid-action-contact": "Error, when the 
3rd-party OAuth developers sends users to a bad authorization url, but we know 
which application made the request and we can link the user to a page to 
contact the developer.\n\nParameters:\n* $1 - URL",
+       "mwoauth-bad-request-missing-params": "Error message when MediaWiki 
makes an error during the authorization process, and fails to send all the 
required url parameters\n* $1 - a link to the explanation of the error. The 
text link is the error code.",
+       "mwoauth-bad-request-invalid-action": "Error, when the 3rd-party OAuth 
developers sends users to a bad authorization url\n* $1 - a link to the 
explanation of the error. The text link is the error code.",
+       "mwoauth-bad-request-invalid-action-contact": "Error, when the 
3rd-party OAuth developers sends users to a bad authorization url, but we know 
which application made the request and we can link the user to a page to 
contact the developer.\n\nParameters:\n* $1 - an URL to contact with the 
author.\n* $2 - a link to the explanation of the error. The text link is the 
error code.",
        "mwoauthdatastore-access-token-not-found": "Error message when an 
invalid access token was submitted",
-       "mwoauthdatastore-request-token-not-found": "Error message when an 
invalid request token was submitted",
+       "mwoauthdatastore-request-token-not-found": "Error message when an 
invalid request token was submitted\n* $1 - a link to the explanation of the 
error. The text link is the error code.",
        "mwoauthdatastore-callback-not-found": "Error message when the callback 
URL is not found in cache.",
        "mwoauthdatastore-request-token-already-used": "Error message when a 
request token that has already been used was resubmitted",
        "mwoauthdatastore-bad-token": "Error message when an invalid token was 
submitted",
@@ -215,11 +215,11 @@
        "mwoauthdatastore-bad-verifier": "Error message when an invalid 
verification code was submitted",
        "mwoauthdatastore-invalid-token-type": "Error message when an invalid 
page was requested",
        "mwoauthgrants-general-error": "Generic error, when something 
unexpected happened while processing the OAuth request",
-       "mwoauthserver-bad-consumer": "Error message when an invalid consumer 
identifier was submitted. Parameters:\n* $1 - application name\n* $2 - central 
wiki's user talk page",
-       "mwoauthserver-bad-consumer-key": "Generic error for users when a 
3rd-party OAuth developer sends users to an invalid url",
+       "mwoauthserver-bad-consumer": "Error message when an invalid consumer 
identifier was submitted. Parameters:\n* $1 - application name\n* $2 - central 
wiki's user talk page\n* $3 - a link to the explanation of the error. The text 
link is the error code.",
+       "mwoauthserver-bad-consumer-key": "Generic error for users when a 
3rd-party OAuth developer sends users to an invalid url\n* $1 - a link to the 
explanation of the error. The text link is the error code.",
        "mwoauthserver-insufficient-rights": "Error message that the user does 
not have the required rights to perform this request",
        "mwoauthserver-invalid-request-token": "Error message when an invalid 
request token was submitted",
-       "mwoauthserver-invalid-user": "Error when the user attempts to use 
OAuth, but they do not have a unified (SUL) account, which is 
required.\n\nParameters:\n* $1 - application name",
+       "mwoauthserver-invalid-user": "Error when the user attempts to use 
OAuth, but they do not have a unified (SUL) account, which is 
required.\n\nParameters:\n* $1 - application name\n* $2 - a link to the 
explanation of the error. The text link is the error code.",
        "mwoauthserver-consumer-no-secret": "Error when a consumer with no 
secret or RSA was submitted",
        "mwoauthserver-consumer-owner-only": "Error when an owner-only consumer 
attempted to use the authorization process",
        "mwoauth-invalid-authorization-title": "Title of the error page when 
the Authorization header is invalid",

-- 
To view, visit https://gerrit.wikimedia.org/r/394860
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I46de236687020d1af64571738cce236c1fdaafa6
Gerrit-PatchSet: 15
Gerrit-Project: mediawiki/extensions/OAuth
Gerrit-Branch: master
Gerrit-Owner: Albert221 <w.albert...@gmail.com>
Gerrit-Reviewer: Brian Wolff <bawolff...@gmail.com>
Gerrit-Reviewer: D3r1ck01 <alangider...@gmail.com>
Gerrit-Reviewer: Gergő Tisza <gti...@wikimedia.org>
Gerrit-Reviewer: Reedy <re...@wikimedia.org>
Gerrit-Reviewer: Siebrand <siebr...@kitano.nl>
Gerrit-Reviewer: Zppix <megadev44s.m...@gmail.com>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to