When debugging why people get emails even though the email selector isn't checked reveals that it adds the notifier no matter what flag exists. This patch limits the notifier to only add the email notifier when a relevant CT is sending a message.

For more info, see #2001702: Message Subscribe sends emails regardless of flag checkmarks in notification-settings

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

ezra-g’s picture

Status: Active » Needs review

Marking as "needs review."

amitaibu’s picture

Status: Needs review » Closed (duplicate)

I think this is a duplicate of #1828184: Message Subscribe sends emails regardless of context so marking accordingly. (If not, please re-open).

Since you took the time to patch, here's a quick review.

+++ b/message_subscribe_email/message_subscribe_email.moduleundefined
@@ -62,13 +62,25 @@ function message_subscribe_email_flag($action, $flag, $content_id, $account) {
+  $ct = $values['entity_type'];

$ct => $entity_type.

+++ b/message_subscribe_email/message_subscribe_email.moduleundefined
@@ -62,13 +62,25 @@ function message_subscribe_email_flag($action, $flag, $content_id, $account) {
+        if (strpos($flag_name, $ct) === 6) {

This looks *very* odd ;)

Also extra bonus points for tests.