Changeset 12131
- Timestamp:
- 05/25/2018 11:29:28 PM (6 years ago)
- Location:
- branches/3.0
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/3.0/src/bp-groups/bp-groups-activity.php
r12123 r12131 393 393 // If current user is not a group member or is banned, user cannot comment. 394 394 if ( ! bp_current_user_can( 'bp_moderate' ) && 395 ( ! groups_is_user_member( bp_loggedin_user_id(), $group_id ) || !groups_is_user_banned( bp_loggedin_user_id(), $group_id ) )395 ( ! groups_is_user_member( bp_loggedin_user_id(), $group_id ) || groups_is_user_banned( bp_loggedin_user_id(), $group_id ) ) 396 396 ) { 397 397 $retval = false; -
branches/3.0/tests/phpunit/testcases/groups/activity.php
r11737 r12131 224 224 $this->set_current_user( $old_user ); 225 225 } 226 227 /** 228 * @group bp_activity_can_comment 229 */ 230 public function test_groups_activity_can_comment() { 231 $old_user = get_current_user_id(); 232 $u1 = self::factory()->user->create(); 233 $u2 = self::factory()->user->create(); 234 235 $g = self::factory()->group->create(); 236 237 // User 1 is a group member, while user 2 isn't. 238 groups_join_group( $g, $u1 ); 239 240 $a = self::factory()->activity->create( array( 241 'component' => buddypress()->groups->id, 242 'type' => 'created_group', 243 'user_id' => $u1, 244 'item_id' => $g, 245 ) ); 246 247 $this->set_current_user( $u1 ); 248 if ( bp_has_activities( array( 'in' => $a ) ) ) { 249 while ( bp_activities() ) : bp_the_activity(); 250 // User 1 should be able to comment. 251 $this->assertTrue( bp_activity_can_comment() ); 252 endwhile; 253 } 254 255 $this->set_current_user( $u2 ); 256 if ( bp_has_activities( array( 'in' => $a ) ) ) { 257 while ( bp_activities() ) : bp_the_activity(); 258 // User 2 should not be able to comment. 259 $this->assertFalse( bp_activity_can_comment() ); 260 endwhile; 261 } 262 263 $this->set_current_user( $old_user ); 264 } 226 265 }
Note: See TracChangeset
for help on using the changeset viewer.