[buddypress-trac] [BuddyPress Trac] #6494: Duplicate activity comments when post/activity comments sync is on

buddypress-trac noreply at wordpress.org
Sun Sep 6 12:49:58 UTC 2015


#6494: Duplicate activity comments when post/activity comments sync is on
------------------------------------+------------------
 Reporter:  imath                   |       Owner:
     Type:  defect (bug)            |      Status:  new
 Priority:  normal                  |   Milestone:  2.4
Component:  Component - Blogs       |     Version:  2.0
 Severity:  normal                  |  Resolution:
 Keywords:  has-patch dev-feedback  |
------------------------------------+------------------
Changes (by imath):

 * keywords:  has-patch => has-patch dev-feedback


Comment:

 Thanks for your feedback r-a-y and it's my turn to apologize for this late
 reply :)

 I think removing the
 [https://buddypress.trac.wordpress.org/browser/tags/2.3.2/src/bp-blogs/bp-
 blogs-functions.php#L646 $_REQUEST['action']] is half fixing the problem.
 I've updated the unit test (see 6494.03.unittest.patch) to try to show
 what the "full" problem is.

 I think if this check was added, it was to be sure a comment was being
 edited within the WP Admin (Ajax or not). WordPress is only using
 `wp_update_comment()` once when `edit_comment()` is used.

 If we remove the check, i agree that the unit tests is showing that no
 duplicate activity comments will be created, but this activity will be
 saved 3 times and the comment will be saved twice. And i think for both
 objects it's one time too much. We should avoid this one time too much.

 Activity should be saved twice and the comment once.
 About activity, why twice? Because it's first saved here
 https://buddypress.trac.wordpress.org/browser/trunk/src/bp-activity/bp-
 activity-functions.php#L2148 and then as it's synced with a post comment,
 we need to update its primary link here:
 https://buddypress.trac.wordpress.org/browser/trunk/src/bp-blogs/bp-blogs-
 activity.php#L607

 so i think it's best to make sure an activity won't be edited right away
 after being posted by doing `remove_action( 'bp_activity_before_save',
 'bp_blogs_sync_activity_edit_to_post_comment', 20 );` in
 `bp_blogs_sync_add_from_activity_comment()` like i've suggested in
 .02.patch.

 What do you think ?

--
Ticket URL: <https://buddypress.trac.wordpress.org/ticket/6494#comment:2>
BuddyPress Trac <http://buddypress.org/>
BuddyPress Trac


More information about the buddypress-trac mailing list