Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
10/11/2015 10:14:29 PM (9 years ago)
Author:
djpaul
Message:

Blogs: don't duplicate activity comments during post/activity sync

When JS is disabled, when you post an activity comment to a blog post
activity item, two activity comments will be created. This happens
because we are updating the activity item three times, and updating the
post comment twice.

This change unhooks some of the actions during activity->blog sync to
prevent these unnecessary updates and the duplicated activity comment.

Fixes #6494

Props imath, r-a-y

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/bp-blogs/bp-blogs-activity.php

    r10100 r10252  
    605605    $resave_activity = new BP_Activity_Activity( $comment_id );
    606606    $resave_activity->primary_link = get_comment_link( $post_comment_id );
     607
     608    /**
     609     * Now that the activity id exists and the post comment was created, we don't need to update
     610     * the content of the comment as there are no chances it has evolved.
     611     */
     612    remove_action( 'bp_activity_before_save', 'bp_blogs_sync_activity_edit_to_post_comment', 20 );
     613
    607614    $resave_activity->save();
     615
     616    // add the edit activity comment hook back
     617    add_action( 'bp_activity_before_save', 'bp_blogs_sync_activity_edit_to_post_comment', 20 );
    608618
    609619    // multisite again!
Note: See TracChangeset for help on using the changeset viewer.