Download & Extend

Subscription mails sent for unpublished nodes

Project:Project issue tracking
Version:6.x-1.x-dev
Component:Mail
Category:bug report
Priority:critical
Assigned:Unassigned
Status:closed (fixed)
Issue tags:6.x-1.0 blocker

Issue Summary

I tried to create a draft issue over at the xmlsitemap issue queue to run it past another person before I put it out for the issue queue "proper", only to discover that e-mail notifications were sent, even though the node was unpublished. :(

Comments

#1

Yes, this is a blocker. It sucks to spend much time on this stuff without fixing d.o subscriptions entirely, but we really need to fix this.

#2

Could it be that the mail got sent due to webchick's administrator role?

mail.inc has the following in place:

<?php
  $grants
= module_implements('node_grants');
 
$check_node_access = $node->status != 1 || empty($anon_auth_access) || !empty($grants);
...
  while (
$recipient = db_fetch_object($result)) {
...
   
$can_access = $check_node_access ? node_access('view', $node, $account) : TRUE;

    if (
$can_access) {
...
     
drupal_mail('project_issue', 'project_issue_update_notification', $recipient->mail, $language, $params, $from);
    }
  }
?>

Seems to me it is doing the right thing. What do you think?

#3

Hah, good point! ;) @yhager: can you test this on a local drupalorg_testing install to confirm that regular users don't get notification emails for unpublished nodes?

Also, what *should* the behavior be here? Should we special-case unpublished and prevent email notification for unpublished issues, even for admins that can view them?

Thanks for looking into this!
-Derek

#4

Status:active» needs review

> can you test this on a local drupalorg_testing install to confirm that regular users don't get notification emails for unpublished nodes?

I tested, and this is indeed the case.

> Also, what *should* the behavior be here?

I think unpublished nodes should not generate any email notifications. The attached patch does just that.

One thing I noticed though is that when the node is being published, email is not being sent (emails are sent only on issue creation, or an addition of a comment). I am not sure how to implement this hook actually if we want to do it (but this should probably be a different issue).

AttachmentSize
yh.patch 671 bytes

#5

Status:needs review» fixed

attached patch tweaks the patch in #4, and has been tested to work. committed to HEAD.

AttachmentSize
pi_dont_mail_unpublished.patch 760 bytes

#6

Status:fixed» closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

nobody click here