Project

General

Profile

Bug #2117

User reports double notification of announcements

Added by Matt Gold almost 10 years ago. Updated over 9 years ago.

Status:
Resolved
Priority name:
Normal
Category name:
BuddyPress (misc)
Target version:
Start date:
2012-09-10
Due date:
% Done:

0%

Estimated time:

Description

The user in question is the admin of the group to which he is posting announcements.

History

#1 Updated by Boone Gorges almost 10 years ago

Steve, could I ask you to forward copies of the duplicate notifications to me? One pair would be fine - I just want to check the headers, to see if the two emails are totally identical.

#2 Updated by Boone Gorges almost 10 years ago

  • Target version changed from 1.4.4 to 1.4.7
  • Severity changed from Normal to Low impact

Thanks for forwarding these along, Steve.

Just to clarify: This is for announcements only, correct? When you post, eg, a forum reply, you only receive one notification?

If that's right, then this is not too pressing an issue, as the Group Announcements feature is not widely used, and in any case the double announcement is more annoying than anything else.

#3 Updated by Steve Brier almost 10 years ago

That's right, Boone. Only get this when I use Group Announcements, which I do a lot with my classes because we can't use email notification on our blogs, which are private.

#4 Updated by Boone Gorges almost 10 years ago

  • Assignee changed from Boone Gorges to Dominic Giglio

Excellent - thanks for the additional info, Steve.

Dom, this functionality is in a plugin called cac-group-announcements. Have a look there to see if you can see any obvious reason why the sender of a group announcement would be getting more than one notification of it. If you have questions about how the plugin works, just let me know (I wrote it, though it's been years since I've looked at how it works).

#5 Updated by Dominic Giglio over 9 years ago

Boone,

After just a cursory look at the plugin in question (it's quite small), I see that it's basically just inserting itself into the group page and then leaning on locate_template( array( 'activity/post-form.php'), true ) to include the input for entering the group-wide update. I'm wondering if the issue here is as simple as this:

Because the group admin receives an email notification of their announcement but also is member of the group they also receive a notification (as a member) through the "Email this update to all group members?" checkbox? Therefore the admin is being notified twice, once as an admin and once as a member of the group?

#6 Updated by Dominic Giglio over 9 years ago

Boone, I just added you as a watcher here. Please see my last update.

#7 Updated by Boone Gorges over 9 years ago

Because the group admin receives an email notification of their announcement but also is member of the group they also receive a notification (as a member) through the "Email this update to all group members?" checkbox? Therefore the admin is being notified twice, once as an admin and once as a member of the group?

It's possible. Have you been able to replicate the issue under this assumption? If so, maybe do a check in the member loop that looks like: If this member is the admin sending the announcement, skip this member and continue to the next one. Give it a try and see what you find.

#8 Updated by Matt Gold over 9 years ago

Just experienced this in a group in which I'm not an admin and didn't send out the announcement. A user put up to announcements; I received two notifications of each one. Here's the group: http://commons.gc.cuny.edu/groups/arc-inequalities-seminar/

#9 Updated by Dominic Giglio over 9 years ago

Boone,

Two questions:

-How do you test something like this locally? Do I have to try and replicate on cdev? Do I need to learn how to setup a local mail server on my Mac so I can actually send announcements?

-Could this be related to #2082 (Default: No Email)?

#10 Updated by Boone Gorges over 9 years ago

How do you test something like this locally?

IIRC, MAMP sets up an outgoing email server automatically. But yes, if you're going to test it locally, you'll have to have a working mail server. If that's a pain, then yes, please go ahead and use cdev.

Could this be related to #2082 (Default: No Email)?

It's unlikely to be directly related. Group "announcements" notifications are not handled through the GES plugin. However, it may be the case that Announcements are, indeed, being handled by GES in the case of some users, which would result in duplicate notifications - so GES would be related, but it wouldn't have anything to do with the No Email issue specifically mentioned in #2082.

#11 Updated by Dominic Giglio over 9 years ago

  • Target version changed from 1.4.7 to 1.4.8

#12 Updated by Dominic Giglio over 9 years ago

  • Target version changed from 1.4.8 to 1.4.9

Boone,

I've been cross testing this issue with #2152.

This one was a little harder to debug but I think I've narrowed it down to the GES plugin. I started debugging the same way I did in #2152, by commenting out anything that looked related to sending an email. That got crazy way too fast, so I decided to check for more general plugin conflicts.

There didn't appear to be any Network Plugins enabled in my local env that could be causing the duplication of emails when an Announcement is submitted, so I moved to the active plugins for The Commons site specifically. I disabled, tested and then re-enabled the cets_blog_defaults, Invite Anyone, Mass Mailer and finally the GES plugin one by one. The only plugin that affected the output was GES. When GES is on it dumps two $phpmailer objects for each announcement. And it dumps two per group member when the "Email this update to all group members?" checkbox is checked. So if I'm in a group with 23 members, it dumps 46 objects. When it's disabled there is no output at all. So I think there is some code in GES that is doubling up on the emails. Maybe an extra action or filter?

This is where I'm continuing my debugging but I wanted to get some feedback to you incase you've got an idea of where I should look specifically.

#13 Updated by Boone Gorges over 9 years ago

  • Status changed from Assigned to Resolved
  • Target version changed from 1.4.9 to 1.4.8

Thanks for the report, Dom.

There shouldn't be an issue with GES, as there's a remove_action() in cac_email_activity_handler() (bp-custom.php) that explicitly prevents GES from firing: remove_action( 'bp_activity_after_save' , 'ass_group_notification_activity' , 50 ); And, in fact, when I put a var_dump() into the GES function ass_group_notification_activity(), I see that it's not actually run when group announcements are fired.

It turns out, in fact, that the function cac_email_activity_handler() is getting fired twice. Since it happens at bp_activity_after_save, it must mean that the activity item is getting resaved at some point. I didn't want to spend a bunch of time figuring out why this is happening and whether it can be stopped, so I just put a little check into cac_email_activity_handler() to make sure it doesn't fire twice in the same pageload: https://github.com/castiron/cac/commit/997abc031803cc2062d95d5316db58554bca58f0 Not all that elegant, but it does the trick.

#14 Updated by Dominic Giglio over 9 years ago

If it works for you then it works for me. :-)

Also available in: Atom PDF