jenkins-bot has submitted this change and it was merged.
Change subject: Display error message on API failure or empty result
..
Display error message on API failure or empty result
Show an API failure message if the request failed.
Also take this opportunity to show a message in case
there are no notifications at all.
Bug: T136467
Change-Id: If5761ec3d3df10a8774561bed06a4ade54458c4b
---
M modules/ui/mw.echo.ui.NotificationBadgeWidget.js
M modules/ui/mw.echo.ui.NotificationsListWidget.js
M modules/ui/mw.echo.ui.PlaceholderItemWidget.js
3 files changed, 15 insertions(+), 6 deletions(-)
Approvals:
Catrope: Looks good to me, approved
jenkins-bot: Verified
diff --git a/modules/ui/mw.echo.ui.NotificationBadgeWidget.js
b/modules/ui/mw.echo.ui.NotificationBadgeWidget.js
index 4b366fa..a06a11f 100644
--- a/modules/ui/mw.echo.ui.NotificationBadgeWidget.js
+++ b/modules/ui/mw.echo.ui.NotificationBadgeWidget.js
@@ -362,8 +362,8 @@
}
},
// Failure
- function ( errObject ) {
-
widget.notificationsWidget.resetLoadingOption( errObject.errInfo );
+ function () {
+
widget.notificationsWidget.resetLoadingOption( mw.msg( 'echo-api-failure' ) );
}
)
.then( this.emit.bind( this, 'finishLoading' ) )
diff --git a/modules/ui/mw.echo.ui.NotificationsListWidget.js
b/modules/ui/mw.echo.ui.NotificationsListWidget.js
index 70a3815..b4af11f 100644
--- a/modules/ui/mw.echo.ui.NotificationsListWidget.js
+++ b/modules/ui/mw.echo.ui.NotificationsListWidget.js
@@ -149,7 +149,12 @@
// Reset the current items and re-add the new item widgets
this.clearItems();
this.addItems( itemWidgets );
- this.resetLoadingOption();
+
+ this.resetLoadingOption(
+ itemWidgets.length === 0 ?
+ mw.msg( 'echo-notification-placeholder' ) :
+ ''
+ );
};
/**
@@ -194,9 +199,7 @@
itemWidgets = this.getItems();
for ( i = 0; i < itemWidgets.length; i++ ) {
- if ( itemWidgets[ i ].resetInitiallyUnseen ) {
- itemWidgets[ i ].resetInitiallyUnseen();
- }
+ itemWidgets[ i ].resetInitiallyUnseen();
}
};
} )( mediaWiki );
diff --git a/modules/ui/mw.echo.ui.PlaceholderItemWidget.js
b/modules/ui/mw.echo.ui.PlaceholderItemWidget.js
index 5af299e..71eff32 100644
--- a/modules/ui/mw.echo.ui.PlaceholderItemWidget.js
+++ b/modules/ui/mw.echo.ui.PlaceholderItemWidget.js
@@ -85,4 +85,10 @@
mw.echo.ui.PlaceholderItemWidget.prototype.getId = function () {
return 0;
};
+
+ /**
+* Do nothing for resetInitiallyUnseen since it is requested by the
list widget
+*/
+ mw.echo.ui.PlaceholderItemWidget.prototype.resetInitiallyUnseen =
function () {};
+
} )( mediaWiki, jQuery );
--
To view, visit https://gerrit.wikimedia.org/r/291834
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: If5761ec3d3df10a8774561bed06a4ade54458c4b
Gerrit-PatchSet: 2
Gerrit-Project: mediawiki/extensions/Echo
Gerrit-Branch: master
Gerrit-Owner: Mooeypoo
Gerrit-Reviewer: Catrope
Gerrit-Reviewer: jenkins-bot <>
___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits