mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/Echo
synced 2024-11-24 07:54:13 +00:00
Move 'notification count refresh' logic out of mapper
Change-Id: I4c10b66e537dea5f9c5bc7ccba8f558cafd103d7
This commit is contained in:
parent
32dd2e314b
commit
1cc0f83829
|
@ -41,9 +41,6 @@ class EchoNotificationMapper extends EchoAbstractMapper {
|
|||
$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 );
|
||||
}
|
||||
|
|
|
@ -144,6 +144,13 @@ class EchoNotification extends EchoAbstractEntity {
|
|||
} );
|
||||
}
|
||||
|
||||
// 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
|
||||
|
|
Loading…
Reference in a new issue