jenkins-bot has submitted this change and it was merged.
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, 18 insertions(+), 0 deletions(-)
Approvals:
Bsitu: Looks good to me, approved
jenkins-bot: Verified
diff --git a/MassMessage.hooks.php b/MassMessage.hooks.php
index 76115a0..71bd99c 100644
--- a/MassMessage.hooks.php
+++ b/MassMessage.hooks.php
@@ -112,4 +112,21 @@
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->getType() == 'mention' && $event->getAgent() && //
getAgent() can return null
+ $event->getAgent()->getId() ==
MassMessage::getMessengerUser()->getId() ) {
+ 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: merged
Gerrit-Change-Id: If8ee6acde77e2d0905aa85ca90625fc915784410
Gerrit-PatchSet: 4
Gerrit-Project: mediawiki/extensions/MassMessage
Gerrit-Branch: master
Gerrit-Owner: Legoktm <[email protected]>
Gerrit-Reviewer: Bsitu <[email protected]>
Gerrit-Reviewer: EBernhardson (WMF) <[email protected]>
Gerrit-Reviewer: Kaldari <[email protected]>
Gerrit-Reviewer: Legoktm <[email protected]>
Gerrit-Reviewer: MZMcBride <[email protected]>
Gerrit-Reviewer: jenkins-bot
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits