Mooeypoo has uploaded a new change for review.
https://gerrit.wikimedia.org/r/240899
Change subject: Update seen time only if the popup is actually open
......................................................................
Update seen time only if the popup is actually open
The notifications can be populated from the popup and outside of it.
We should update the seen time only if the request came from the popup
itself, and only if it is still open by the time the api request
has finished.
Bug: T113645
Change-Id: Id91ddabb85fd582be1890ea420d0559e0cdca167
---
M modules/ooui/mw.echo.ui.NotificationBadgeWidget.js
1 file changed, 9 insertions(+), 7 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Echo
refs/changes/99/240899/1
diff --git a/modules/ooui/mw.echo.ui.NotificationBadgeWidget.js
b/modules/ooui/mw.echo.ui.NotificationBadgeWidget.js
index 6418db9..ef4633c 100644
--- a/modules/ooui/mw.echo.ui.NotificationBadgeWidget.js
+++ b/modules/ooui/mw.echo.ui.NotificationBadgeWidget.js
@@ -263,12 +263,6 @@
return
widget.notificationsModel.markAllRead();
}
} )
- .then( function () {
- if ( widget.popup.isVisible() ) {
- // Update seen time
-
widget.notificationsModel.updateSeenTime();
- }
- } )
.then(
// Success
function () {
@@ -300,6 +294,8 @@
* Extend the response to button click so we can also update the
notification list.
*/
mw.echo.ui.NotificationBadgeWidget.prototype.onPopupToggle = function (
isVisible ) {
+ var widget = this;
+
if ( !isVisible ) {
// If the popup is closing, remove "initiallyUnseen"
and leave
this.notificationsWidget.resetNotificationItems();
@@ -325,7 +321,13 @@
}
// Always populate on popup open. The model and widget should
handle
// the case where the promise is already underway.
- this.populateNotifications();
+ this.populateNotifications()
+ .then( function () {
+ if ( widget.popup.isVisible() ) {
+ // Update seen time
+
widget.notificationsModel.updateSeenTime();
+ }
+ } );
this.hasRunFirstTime = true;
};
--
To view, visit https://gerrit.wikimedia.org/r/240899
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Id91ddabb85fd582be1890ea420d0559e0cdca167
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