diff --git a/controller/NotificationController.php b/controller/NotificationController.php index eff7a805d..1b8af9ed7 100644 --- a/controller/NotificationController.php +++ b/controller/NotificationController.php @@ -204,6 +204,12 @@ class EchoNotificationController { 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 740ea2e64..b56fff47e 100644 --- a/includes/DiscussionParser.php +++ b/includes/DiscussionParser.php @@ -112,8 +112,9 @@ abstract class EchoDiscussionParser { // 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;