Mooeypoo has uploaded a new change for review.
https://gerrit.wikimedia.org/r/265652
Change subject: Create a specific message for CORS failure in cross-wiki API
request
......................................................................
Create a specific message for CORS failure in cross-wiki API request
Bug: T123797
Change-Id: I877c826a5571fb1f664af496b9b3469aa24884f6
---
M Resources.php
M i18n/en.json
M i18n/qqq.json
M modules/viewmodel/mw.echo.dm.NotificationsModel.js
4 files changed, 14 insertions(+), 1 deletion(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Echo
refs/changes/52/265652/1
diff --git a/Resources.php b/Resources.php
index 792db95..fb3958d 100644
--- a/Resources.php
+++ b/Resources.php
@@ -127,6 +127,7 @@
),
'messages' => array(
'echo-api-failure',
+ 'echo-api-failure-cross-wiki',
),
'targets' => array( 'desktop', 'mobile' ),
),
diff --git a/i18n/en.json b/i18n/en.json
index 87d67e9..e7e16ee 100644
--- a/i18n/en.json
+++ b/i18n/en.json
@@ -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.",
diff --git a/i18n/qqq.json b/i18n/qqq.json
index 47f1af2..7b5f4b9 100644
--- a/i18n/qqq.json
+++ b/i18n/qqq.json
@@ -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.",
diff --git a/modules/viewmodel/mw.echo.dm.NotificationsModel.js
b/modules/viewmodel/mw.echo.dm.NotificationsModel.js
index f2e2be6..196ef71 100644
--- a/modules/viewmodel/mw.echo.dm.NotificationsModel.js
+++ b/modules/viewmodel/mw.echo.dm.NotificationsModel.js
@@ -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' )
+ } );
}
);
};
--
To view, visit https://gerrit.wikimedia.org/r/265652
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I877c826a5571fb1f664af496b9b3469aa24884f6
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Echo
Gerrit-Branch: master
Gerrit-Owner: Mooeypoo <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits