Changeset 8177
- Timestamp:
- 03/27/2014 07:29:08 PM (10 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/bp-activity/bp-activity-functions.php
r8175 r8177 471 471 $user_id = bp_loggedin_user_id(); 472 472 473 // Remove the fav from the user's favs474 473 $my_favs = bp_get_user_meta( $user_id, 'bp_favorite_activities', true ); 475 474 $my_favs = array_flip( (array) $my_favs ); 475 476 // Bail if the user has not previously favorited the item 477 if ( ! isset( $my_favs[ $activity_id ] ) ) { 478 return false; 479 } 480 481 // Remove the fav from the user's favs 476 482 unset( $my_favs[$activity_id] ); 477 483 $my_favs = array_unique( array_flip( $my_favs ) ); -
trunk/tests/testcases/activity/functions.php
r8175 r8177 711 711 } 712 712 713 /** 714 * @group favorites 715 * @group bp_activity_remove_user_favorite 716 */ 717 public function test_remove_user_favorite_bad_activity_id() { 718 $u1 = $this->create_user(); 719 $u2 = $this->create_user(); 720 $a = $this->factory->activity->create(); 721 722 // Only favorite for user 1 723 bp_activity_add_user_favorite( $a, $u1 ); 724 725 // Removing for user 2 should fail 726 $this->assertFalse( bp_activity_remove_user_favorite( $a, $u2 ) ); 727 $this->assertEquals( 1, bp_activity_get_meta( $a, 'favorite_count' ) ); 728 } 729 713 730 public function check_activity_caches() { 714 731 foreach ( $this->acaches as $k => $v ) {
Note: See TracChangeset
for help on using the changeset viewer.