boonebgorges / buddypress-group-email-subscription

Fine-grained email subscription for activity in BuddyPress groups
35 stars 31 forks source link

Replies to Group posts not sent when "All Email" is set #240

Closed kurtgschumacher closed 1 year ago

kurtgschumacher commented 1 year ago

New BuddyPress user here. I installed Group Email Subscription so that Members would get notifications of updates to Group and Forum posts. Here's what I did.

I have more testing to do, but it seems as if the plugin is treating "All Email" the same as "New Topics- Send new topics as they arrive (but no replies)".

Just to be clear, these are Group posts, not Forum posts. (I haven't gotten to Forums yet.)

boonebgorges commented 1 year ago

Thanks for the ticket.

This is not related to the 'New Topics' setting, which is only relevant for forum posts.

The issue is that activity comments are created with component=activity. See https://buddypress.trac.wordpress.org/browser/tags/11.2.0/src/bp-activity/bp-activity-functions.php?marks=2832#L2817. BPGES ignores all activity that doesn't have component=groups, so it ignores activity comments. See https://github.com/boonebgorges/buddypress-group-email-subscription/blob/master/bp-activity-subscription-functions.php#L109

It appears that this has always been the behavior of BP + BPGES. See #105.

It does seem a bit strange. IMHO, it's weird behavior on BP's part that activity_comment items don't inherit the 'component' of their parents. That being said, it's probably impossible to change the BP behavior because of compatibility concerns. (cc @r-a-y in case you have thoughts about that) Instead, I think we can consider changing the behavior of BPGES so that it includes activity where either (a) component=groups (current behavior) OR (b) it's an activity_comment whose root activity item (item_id) has component=groups.

Perhaps we'll look at this for the next major release.

kurtgschumacher commented 1 year ago

Thanks for the response. In the Best of All Possible Worlds,settings for Group posts and Forum posts would work the same way. But of course, BPGES has to work with both BP and bbPress, leaving opportunities for inconsistencies.

r-a-y commented 1 year ago

BPGES ignores all activity that doesn't have component=groups, so it ignores activity comments.

It looks like we broke this functionality in GES 3.9.0.

GES 3.8.2 previously did the activity comment lookup: https://github.com/boonebgorges/buddypress-group-email-subscription/blob/1282d7d22a926ead9edd643008b9a629382ab7c3/bp-activity-subscription-functions.php#L106-L120

GES 3.9.0 omits the activity comment code block: https://github.com/boonebgorges/buddypress-group-email-subscription/blob/97696bc3f674b22780abd8f577f80e07f81056cf/bp-activity-subscription-functions.php#L106-L109

I'm guessing since we changed to async sending in GES 3.9.0 that the older 3.8.2 method would not work. We can bring it back by doing parent item lookups as you mention, but we should probably do this only for activity comments. I'm not sure if we want to do parent item lookups for all activity types though as that is probably unnecessary.

kurtgschumacher commented 1 year ago

I was a software developer for over 40 years, so I'm very familiar with the "fix 10 things, break 2" cycle. ;-)

boonebgorges commented 1 year ago

Good call, @r-a-y. I guess this was an error on my part 569b329dac65b185ff14b24d5b4a705a275ac68e

I'll go ahead and reintroduce similar logic, this time using item_id rather than relying on bp_is_groups_component().

boonebgorges commented 1 year ago

1352e13 should fix it, and because it references item_id, it should be more reliable if an application is created activity_comments programmatically.

kurtgschumacher commented 1 year ago

Thanks, guys. I'll look for the fix in the updates. This isn't critical for me, this is out Family site, and if someone needs immediate notification of a post I can just shout up the stairs.

kurtgschumacher commented 1 year ago

Update installed and tested, and it's working. Thanks again for the amazingly fast response!