Aude has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/383044 )

Change subject: Disable email notifications for wikibase changes in client wikis
......................................................................

Disable email notifications for wikibase changes in client wikis

Bug: T174794
Change-Id: I18f62f2209f5547ac4db22021359e6c6dfbccbd5
---
M client/WikibaseClient.hooks.php
M client/WikibaseClient.php
A client/tests/phpunit/includes/ClientHooksTest.php
3 files changed, 31 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Wikibase 
refs/changes/44/383044/1

diff --git a/client/WikibaseClient.hooks.php b/client/WikibaseClient.hooks.php
index 19835cd..ff5e97f 100644
--- a/client/WikibaseClient.hooks.php
+++ b/client/WikibaseClient.hooks.php
@@ -8,6 +8,7 @@
 use EditPage;
 use OutputPage;
 use Parser;
+use RecentChange;
 use Skin;
 use StubObject;
 use Title;
@@ -318,6 +319,20 @@
        }
 
        /**
+        * @param User $editor
+        * @param Title $title
+        * @param RecentChange $recentChange
+        * @return bool
+        */
+       public static function onAbortEmailNotification( User $editor, Title 
$title, RecentChange $recentChange ) {
+               if ( $recentChange->getAttribute('rc_source') === 
RecentChangeFactory::SRC_WIKIBASE ) {
+                       return false;
+               }
+
+               return true;
+       }
+
+       /**
         * Do special hook registrations.  These are affected by ordering 
issues and/or
         * conditional on another extension being registered.
         *
diff --git a/client/WikibaseClient.php b/client/WikibaseClient.php
index 352da9f..b1aeccb 100644
--- a/client/WikibaseClient.php
+++ b/client/WikibaseClient.php
@@ -147,6 +147,7 @@
        $wgHooks['ParserLimitReportPrepare'][] = 
'\Wikibase\Client\Hooks\ParserLimitReportPrepareHookHandler::onParserLimitReportPrepare';
        $wgHooks['FormatAutocomments'][] = '\Wikibase\ClientHooks::onFormat';
        $wgHooks['ParserClearState'][] = 
'\Wikibase\Client\Hooks\ParserClearStateHookHandler::onParserClearState';
+       $wgHooks['AbortEmailNotification'][] = 
'\Wikibase\ClientHooks::onAbortEmailNotification';
 
        // for client notifications (requires the Echo extension)
        // note that Echo calls BeforeCreateEchoEvent hook when it is being 
initialized,
diff --git a/client/tests/phpunit/includes/ClientHooksTest.php 
b/client/tests/phpunit/includes/ClientHooksTest.php
new file mode 100644
index 0000000..b8495d8
--- /dev/null
+++ b/client/tests/phpunit/includes/ClientHooksTest.php
@@ -0,0 +1,15 @@
+<?php
+/**
+ * Created by PhpStorm.
+ * User: katie
+ * Date: 10/8/17
+ * Time: 8:16 PM
+ */
+
+namespace Wikibase\Client\Tests;
+
+
+class ClientHooksTest
+{
+
+}
\ No newline at end of file

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I18f62f2209f5547ac4db22021359e6c6dfbccbd5
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Wikibase
Gerrit-Branch: master
Gerrit-Owner: Aude <[email protected]>

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

Reply via email to