jenkins-bot has submitted this change and it was merged.
Change subject: Remove 'initiallyUnseen' class when the popup closes
......................................................................
Remove 'initiallyUnseen' class when the popup closes
The popup automatically updates itself every time it is opened.
If there are unseen notifications, they should be updated when the
next fetch happens, which means we must take off that class so
that the animation doesn't repeat itself.
Change-Id: Ib4173631efa1c5a3a3509e0797e60397397bd009
---
M modules/ooui/mw.echo.ui.NotificationBadgeWidget.js
M modules/ooui/mw.echo.ui.NotificationOptionWidget.js
M modules/ooui/mw.echo.ui.NotificationsWidget.js
3 files changed, 28 insertions(+), 1 deletion(-)
Approvals:
Catrope: Looks good to me, approved
jenkins-bot: Verified
diff --git a/modules/ooui/mw.echo.ui.NotificationBadgeWidget.js
b/modules/ooui/mw.echo.ui.NotificationBadgeWidget.js
index 3ae932b..974544b 100644
--- a/modules/ooui/mw.echo.ui.NotificationBadgeWidget.js
+++ b/modules/ooui/mw.echo.ui.NotificationBadgeWidget.js
@@ -284,7 +284,8 @@
*/
mw.echo.ui.NotificationBadgeWidget.prototype.onPopupToggle = function (
isVisible ) {
if ( !isVisible ) {
- // If the popup is closing, leave
+ // If the popup is closing, remove "initiallyUnseen"
and leave
+ this.notificationsWidget.resetNotificationItems();
return;
}
diff --git a/modules/ooui/mw.echo.ui.NotificationOptionWidget.js
b/modules/ooui/mw.echo.ui.NotificationOptionWidget.js
index a4fdc54..0e9526a 100644
--- a/modules/ooui/mw.echo.ui.NotificationOptionWidget.js
+++ b/modules/ooui/mw.echo.ui.NotificationOptionWidget.js
@@ -77,6 +77,17 @@
mw.echo.ui.NotificationOptionWidget.prototype.onMarkAsReadButtonClick =
function () {
this.model.toggleRead( true );
};
+
+ /**
+ * Reset the status of the notification without touching its
user-controlled status.
+ * For one, remove 'initiallyUnseen' which exists only for the
animation to work.
+ * This is called when new notifications are added to the parent
widget, having to
+ * reset the 'unseen' status from the old ones.
+ */
+ mw.echo.ui.NotificationOptionWidget.prototype.reset = function () {
+ this.$element.removeClass(
'mw-echo-ui-notificationOptionWidget-initiallyUnseen' );
+ };
+
/**
* Toggle the read state of the widget
*
diff --git a/modules/ooui/mw.echo.ui.NotificationsWidget.js
b/modules/ooui/mw.echo.ui.NotificationsWidget.js
index b37bc15..9403b12 100644
--- a/modules/ooui/mw.echo.ui.NotificationsWidget.js
+++ b/modules/ooui/mw.echo.ui.NotificationsWidget.js
@@ -123,6 +123,21 @@
};
/**
+ * Go over the items and remove all items with 'initiallyUnseen' class
on them.
+ * That class is given to the widgets so that the animation works. When
we refresh
+ * the notifications, they should no longer be animated, allowing any
new notifications
+ * that were fetched to be set as unseen.
+ */
+ mw.echo.ui.NotificationsWidget.prototype.resetNotificationItems =
function () {
+ var i, len,
+ items = this.getItems();
+
+ for ( i = 0, len = items.length; i < len; i++ ) {
+ items[i].reset();
+ }
+ };
+
+ /**
* Reset the loading 'dummy' option widget
*
* @param {string} [label] Label for the option widget
--
To view, visit https://gerrit.wikimedia.org/r/240295
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: Ib4173631efa1c5a3a3509e0797e60397397bd009
Gerrit-PatchSet: 2
Gerrit-Project: mediawiki/extensions/Echo
Gerrit-Branch: master
Gerrit-Owner: Mooeypoo <[email protected]>
Gerrit-Reviewer: Catrope <[email protected]>
Gerrit-Reviewer: jenkins-bot <>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits