Create a specific message for CORS failure in cross-wiki API request

Bug: T123797
Change-Id: I877c826a5571fb1f664af496b9b3469aa24884f6
This commit is contained in:
Moriel Schottlender 2016-01-21 15:03:39 -08:00
parent 97d5a3f293
commit a85561d3d8
4 changed files with 14 additions and 1 deletions

View file

@ -127,6 +127,7 @@ $wgResourceModules += array(
),
'messages' => array(
'echo-api-failure',
'echo-api-failure-cross-wiki',
),
'targets' => array( 'desktop', 'mobile' ),
),

View file

@ -53,6 +53,7 @@
"echo-feedback": "Feedback",
"echo-quotation-marks": "\"$1\"",
"echo-api-failure": "Could not retrieve notifications. Please try again. (Error $1)",
"echo-api-failure-cross-wiki": "Access to the remote domain was denied.",
"echo-notification-placeholder": "There are no notifications.",
"echo-notification-loginrequired": "You must login to see your notifications.",
"echo-notification-popup-loginrequired": "Please log in to view your notifications.",

View file

@ -74,6 +74,7 @@
"echo-feedback": "Text for a link that goes to a feedback survey shown at [[Special:Notifications]].\n{{Identical|Feedback}}",
"echo-quotation-marks": "Unused at this time.\n\n{{optional}}\nPuts the edit summary in quotation marks. Only translate if different than English.\n\nParameters:\n* $1 - ...",
"echo-api-failure": "Label for the text that notes an error in retrieving notifications for the Echo popup.\n$1 - The api error code.",
"echo-api-failure-cross-wiki": "Label for the api failure text for a failure to fetch cross-wiki notifications, but the remote server is not granted access.",
"echo-notification-placeholder": "Label for the text that appears if there are no notifications in the Echo popup.",
"echo-notification-loginrequired": "Message that displays when an anonymous user attempts to view notifications and gets redirect to the login page.",
"echo-notification-popup-loginrequired": "Message that displays when an anonymous user attempts to view notifications in their popup after a session expired.",

View file

@ -562,7 +562,17 @@
},
// Failure
function ( errCode, errObj ) {
model.emit( 'done', false, { errCode: errCode, errInfo: OO.getProp( errObj, 'error', 'info' ) } );
// TODO: The 'analysis' of which error we are working with should
// be in the network layer of Echo's frontend code
model.emit(
'done',
false,
{
errCode: errCode,
errInfo: errCode === 'http' ?
mw.msg( 'echo-api-failure-cross-wiki' ) :
OO.getProp( errObj, 'error', 'info' )
} );
}
);
};