Legoktm has uploaded a new change for review.

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


Change subject: Prevent Echo mention notifications for MassMessage messages
......................................................................

Prevent Echo mention notifications for MassMessage messages

Hook into Echo, and abort any mention notifications if the user
is the bot, and the type is 'mention'.

Depends on I376708ac7aafc419bf87bceeff6de7de9bdc2f4e in Echo.

Change-Id: If8ee6acde77e2d0905aa85ca90625fc915784410
---
M MassMessage.hooks.php
M MassMessage.php
2 files changed, 17 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/MassMessage 
refs/changes/56/86356/1

diff --git a/MassMessage.hooks.php b/MassMessage.hooks.php
index 76115a0..088216f 100644
--- a/MassMessage.hooks.php
+++ b/MassMessage.hooks.php
@@ -112,4 +112,20 @@
 
                return true;
        }
+
+       /**
+        * Echo!
+        *
+        * @param $event EchoEvent
+        * @return bool
+        */
+       public static function onBeforeEchoEventInsert( &$event ) {
+               // Don't spam a user with mention notifications if it's a 
MassMessage
+               if ( $event->getAgent() == MassMessage::getMessengerUser() && 
$event->getType() == 'mention' ) {
+                       return false;
+               }
+
+               return true;
+       }
+
 }
diff --git a/MassMessage.php b/MassMessage.php
index cec1eb4..7695742 100644
--- a/MassMessage.php
+++ b/MassMessage.php
@@ -68,6 +68,7 @@
 $wgHooks['RenameUserPreRename'][] = 'MassMessageHooks::onRenameUserPreRename';
 $wgHooks['UserGetReservedNames'][] = 
'MassMessageHooks::onUserGetReservedNames';
 $wgHooks['UnitTestsList'][] = 'MassMessageHooks::onUnitTestsList';
+$wgHooks['BeforeEchoEventInsert'][] = 
'MassMessageHooks::onBeforeEchoEventInsert';
 
 $wgResourceModules['ext.MassMessage.special.js'] = array(
        'scripts' => array(

-- 
To view, visit https://gerrit.wikimedia.org/r/86356
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: If8ee6acde77e2d0905aa85ca90625fc915784410
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/MassMessage
Gerrit-Branch: master
Gerrit-Owner: Legoktm <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to