Skip to:
Content

BuddyPress.org

Ticket #5863: 5863.01.patch

File 5863.01.patch, 1.5 KB (added by r-a-y, 9 years ago)
  • src/bp-activity/bp-activity-functions.php

     
    16231623                return false;
    16241624        }
    16251625
     1626        // Purge comment cache for the root activity update
     1627        wp_cache_delete( $activity_id, 'bp_activity_comments' );
     1628
    16261629        // Recalculate the comment tree
    16271630        BP_Activity_Activity::rebuild_activity_comment_tree( $activity_id );
    16281631
  • tests/phpunit/testcases/activity/functions.php

     
    696696        }
    697697
    698698        /**
     699         * @group bp_activity_delete_comment
     700         * @group cache
     701         */
     702        public function test_bp_activity_delete_comment_clear_cache() {
     703                // add new activity update and comment to this update
     704                $a1 = $this->factory->activity->create();
     705                $a2 = bp_activity_new_comment( array(
     706                        'activity_id' => $a1,
     707                        'parent_id' => $a1,
     708                        'content' => 'foo',
     709                        'user_id' => 1,
     710                ) );
     711
     712                // prime cache
     713                bp_activity_get( array(
     714                        'in' => array( $a1 ),
     715                        'display_comments' => 'threaded',
     716                ) );
     717
     718                // delete activity comment
     719                bp_activity_delete_comment( $a1, $a2 );
     720
     721                // assert comment cache as empty for $a1
     722                $this->assertEmpty( wp_cache_get( $a1, 'bp_activity_comments' ) );
     723        }
     724
     725        /**
    699726         * @group favorites
    700727         * @group bp_activity_add_user_favorite
    701728         */