Mooeypoo has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/240295

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.NotificationsWidget.js
2 files changed, 17 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Echo 
refs/changes/95/240295/1

diff --git a/modules/ooui/mw.echo.ui.NotificationBadgeWidget.js 
b/modules/ooui/mw.echo.ui.NotificationBadgeWidget.js
index 3ae932b..0523c81 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.removeInitiallyUnseen();
                        return;
                }
 
diff --git a/modules/ooui/mw.echo.ui.NotificationsWidget.js 
b/modules/ooui/mw.echo.ui.NotificationsWidget.js
index b37bc15..c11c414 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.removeInitiallyUnseen = 
function () {
+               var i, len,
+                       items = this.getItems();
+
+               for ( i = 0, len = items.length; i < len; i++ ) {
+                       items.$element.removeClass( 
'mw-echo-ui-notificationOptionWidget-initiallyUnseen' );
+               }
+       };
+
+       /**
         * 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: newchange
Gerrit-Change-Id: Ib4173631efa1c5a3a3509e0797e60397397bd009
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

Reply via email to