Kaldari has submitted this change and it was merged.

Change subject: (bug 46046) Notification should not be created for anon users
......................................................................


(bug 46046) Notification should not be created for anon users

Anon users would not see or receive notifications, it is a waste of storage 
space

Change-Id: Id150be111337f434d0f1471bb8049ed75a0c53a5
---
M controller/NotificationController.php
M includes/DiscussionParser.php
2 files changed, 8 insertions(+), 1 deletion(-)

Approvals:
  Kaldari: Verified; Looks good to me, approved
  jenkins-bot: Checked



diff --git a/controller/NotificationController.php 
b/controller/NotificationController.php
index eff7a80..1b8af9e 100644
--- a/controller/NotificationController.php
+++ b/controller/NotificationController.php
@@ -204,6 +204,12 @@
 
                        foreach ( $subscriptions as $subscription ) {
                                $user = $subscription->getUser();
+
+                               // Notification should not be sent to anonymous 
user
+                               if ( $user->isAnon() ) {
+                                       continue;
+                               }
+
                                $notifyTypes = 
$subscription->getNotificationTypes();
 
                                $notifyTypes = array_keys( array_filter( 
$notifyTypes ) );
diff --git a/includes/DiscussionParser.php b/includes/DiscussionParser.php
index 6289c75..fc3be2a 100644
--- a/includes/DiscussionParser.php
+++ b/includes/DiscussionParser.php
@@ -111,8 +111,9 @@
                        // 1. the user name is not valid
                        // 2. the user mentions themselves
                        // 3. the user is the owner of the talk page
+                       // 4. user is anonymous
                        if (
-                               !$user || $user->getId() == 
$revision->getUser() ||
+                               !$user || $user->isAnon() || $user->getId() == 
$revision->getUser() ||
                                ( $title->getNamespace() === NS_USER_TALK && 
$title->getDBkey() === $dbk )
                        ) {
                                continue;

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

Gerrit-MessageType: merged
Gerrit-Change-Id: Id150be111337f434d0f1471bb8049ed75a0c53a5
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Echo
Gerrit-Branch: master
Gerrit-Owner: Bsitu <[email protected]>
Gerrit-Reviewer: Kaldari <[email protected]>
Gerrit-Reviewer: jenkins-bot

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

Reply via email to