Project

General

Profile

Bug #8535

Blog post edit triggers group notification

Added by Boone Gorges over 1 year ago. Updated over 1 year ago.

Status:
Resolved
Priority name:
Normal
Assignee:
Category name:
Group Blogs
Target version:
Start date:
2017-08-15
Due date:
% Done:

0%

Estimated time:


Related issues

Related to CUNY Academic Commons - Bug #8183: Edit of Post creates notification emailsResolved2017-05-22

Related to CUNY Academic Commons - Bug #2844: Commons bug re: editing blog postsResolved2013-10-22

Related to CUNY Academic Commons - Bug #6350: Editing blog posts results in activity itemsResolved2013-10-22

History

#1 Updated by Boone Gorges over 1 year ago

  • Related to Bug #8183: Edit of Post creates notification emails added

#2 Updated by Boone Gorges over 1 year ago

  • Related to Bug #2844: Commons bug re: editing blog posts added

#3 Updated by Boone Gorges over 1 year ago

  • Related to Bug #6350: Editing blog posts results in activity items added

#4 Updated by Boone Gorges over 1 year ago

Here's the relevant data from the activity table:

id: 467129
date_recorded: 2017-08-15 17:56:57
type: new_groupblog_post

Sequentially, the id 467129 means that the activity item was created just this afternoon (at the date_recorded timestamp). It was not a modification of an existing activity item.

Ray, do you have a hypothesis about what might be happening here? Is it possible that the activity item corresponding to the original blog post was deleted, so that when the edit took place, bp-groupblog created a new activity item? If this is true, then why does the `action` read "...edited the blog post..." instead of "...wrote a new blog post..."?

#5 Updated by Raymond Hoh over 1 year ago

I think that the following line might not be necessary anymore in bp-groupblog:
add_action( 'bp_activity_before_save', 'bp_groupblog_set_group_to_post_activity');

See:
https://github.com/boonebgorges/bp-groupblog/blob/1.8.x/bp-groupblog.php#L1211

This is because we are already hooking into the 'transition_post_status' hook to handle edits:
https://github.com/boonebgorges/bp-groupblog/blob/1.8.x/bp-groupblog.php#L1093

So what is happening at the moment is our edit activity catcher is running twice. Removing one of them should fix the issue. Does that sound about right, Boone?

And yes, I do believe the original activity item was somehow deleted.

#6 Updated by Raymond Hoh over 1 year ago

  • Assignee set to Raymond Hoh
  • Target version set to 1.11.10

Did some local testing and discovered that we no longer need to hook onto the 'transition_post_status' hook as this was causing the additional email during edits. Not sure exactly which version of BuddyPress made these changes unnecessary, but I don't feel like going through the BuddyPress changelog to find out :)

Fixed in https://github.com/cuny-academic-commons/cac/commit/8b26dac1342cc668254ec54e4824366a09e5a7f8.

#7 Updated by Boone Gorges over 1 year ago

Excellent - thanks, Ray. Perhaps it's linked to https://buddypress.trac.wordpress.org/ticket/6834?

If so, then making the same change to the mainline bp-groupblog plugin will effectively bump the minimum requirement to BP 2.5. Does that sound correct to you?

#8 Updated by Boone Gorges over 1 year ago

  • Status changed from New to Resolved

Ray, if you get a minute, could you think about my question above?

I think we can mark this ticket resolved for the purposes of the Commons.

#9 Updated by Raymond Hoh over 1 year ago

Boone, it looks like you're correct about BP ticket 6834.

This will indeed bump the requirement for bp-groupblog to BP v2.5 unless we check if the current version of BuddyPress is 2.5.

We could do the following inside bp_groupblog_catch_transition_post_type_status():

// If BP 2.5, bail.
if ( function_exists( 'bp_register_post_types' ) ) {
    return;
}

That way we keep compatibility with older versions.

#10 Updated by Boone Gorges over 1 year ago

Good call, Ray! I'll implement that.

Also available in: Atom PDF