Matthias Mullie has submitted this change and it was merged.
Change subject: Move 'notification count refresh' logic out of mapper
......................................................................
Move 'notification count refresh' logic out of mapper
Change-Id: I4c10b66e537dea5f9c5bc7ccba8f558cafd103d7
---
M includes/mapper/NotificationMapper.php
M model/Notification.php
2 files changed, 7 insertions(+), 3 deletions(-)
Approvals:
Matthias Mullie: Looks good to me, approved
jenkins-bot: Verified
diff --git a/includes/mapper/NotificationMapper.php
b/includes/mapper/NotificationMapper.php
index 306fe60..fe4efaa 100644
--- a/includes/mapper/NotificationMapper.php
+++ b/includes/mapper/NotificationMapper.php
@@ -41,9 +41,6 @@
$dbw->endAtomic( $fname );
if ( $res ) {
- // @Todo - move the reset notification count
logic to a listener
- $user = User::newFromId(
$row['notification_user'] );
- MWEchoNotifUser::newFromUser( $user
)->resetNotificationCount( DB_MASTER );
foreach ( $listeners as $listener ) {
call_user_func( $listener );
}
diff --git a/model/Notification.php b/model/Notification.php
index 81b3cf2..d8d754c 100644
--- a/model/Notification.php
+++ b/model/Notification.php
@@ -144,6 +144,13 @@
} );
}
+ // Add listener to refresh notification count upon insert
+ $notifMapper->attachListener( 'insert', 'refresh-notif-count',
+ function() use ( $user ) {
+ MWEchoNotifUser::newFromUser( $user
)->resetNotificationCount( DB_MASTER );
+ }
+ );
+
$notifMapper->insert( $this );
// Clear applicable section status from cache upon new
notification creation
--
To view, visit https://gerrit.wikimedia.org/r/153702
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I4c10b66e537dea5f9c5bc7ccba8f558cafd103d7
Gerrit-PatchSet: 2
Gerrit-Project: mediawiki/extensions/Echo
Gerrit-Branch: master
Gerrit-Owner: Bsitu <[email protected]>
Gerrit-Reviewer: Legoktm <[email protected]>
Gerrit-Reviewer: Matthias Mullie <[email protected]>
Gerrit-Reviewer: jenkins-bot <>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits