Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
01/17/2015 12:09:31 AM (10 years ago)
Author:
imath
Message:

Make sure the cached activities first page is cleared when an item is updated

In case one of the activities of the first page is edited, we need to clear the bp_activity_sitewide_front cache so that the stream is refreshed with the latest version of the edited activity.

Fixes #6127

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/testcases/activity/cache.php

    r8958 r9367  
    5454        $this->assertEquals( $expected, $found );
    5555    }
     56
     57    /**
     58     * @group bp_activity_clear_cache_for_activity
     59     */
     60    public function test_bp_activity_clear_cache_for_activity() {
     61        $u = $this->factory->user->create();
     62
     63        $a = $this->factory->activity->create( array(
     64            'component'     => buddypress()->activity->id,
     65            'type'          => 'activity_update',
     66            'user_id'       => $u,
     67            'content'       => 'foo bar',
     68        ) );
     69
     70        $a_fp = bp_activity_get( array(
     71            'type' => 'activity_update',
     72            'user' => array( 'filter' => array( 'user_id' => $u ) ),
     73        ) );
     74
     75        $activity_updated = new BP_Activity_Activity( $a );
     76        $activity_updated->content = 'bar foo';
     77        $activity_updated->save();
     78
     79        $a_fp = bp_activity_get( array(
     80            'type' => 'activity_update',
     81            'user' => array( 'filter' => array( 'user_id' => $u ) ),
     82        ) );
     83
     84        $this->assertSame( 'bar foo', $a_fp['activities'][0]->content );
     85    }
    5686}
Note: See TracChangeset for help on using the changeset viewer.