Changeset 11583
- Timestamp:
- 06/09/2017 08:35:52 PM (8 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/bp-activity/bp-activity-functions.php
r11447 r11583 2964 2964 } 2965 2965 2966 // Check if comment still exists. 2967 $comment = new BP_Activity_Activity( $comment_id ); 2968 if ( empty( $comment->id ) ) { 2969 return false; 2970 } 2971 2966 2972 // Delete any children of this comment. 2967 2973 bp_activity_delete_children( $activity_id, $comment_id ); … … 3004 3010 */ 3005 3011 function bp_activity_delete_children( $activity_id, $comment_id ) { 3012 // Check if comment still exists. 3013 $comment = new BP_Activity_Activity( $comment_id ); 3014 if ( empty( $comment->id ) ) { 3015 return; 3016 } 3006 3017 3007 3018 // Get activity children to delete. -
trunk/tests/phpunit/testcases/activity/functions.php
r10545 r11583 1279 1279 1280 1280 /** 1281 * @group bp_activity_delete_comment 1282 * @ticket BP7450 1283 */ 1284 public function test_bp_activity_delete_comment_shouldnt_delete_all_comments_when_parameters_are_empty() { 1285 $u = $this->factory->user->create(); 1286 1287 // create an activity update 1288 $parent_activity = $this->factory->activity->create( array( 1289 'type' => 'activity_update', 1290 'user_id' => $u 1291 ) ); 1292 1293 // create some activity comments 1294 $comment_one = bp_activity_new_comment( array( 1295 'user_id' => $u, 1296 'activity_id' => $parent_activity, 1297 'content' => 'depth 1' 1298 ) ); 1299 1300 $comment_one_one = bp_activity_new_comment( array( 1301 'user_id' => $u, 1302 'activity_id' => $parent_activity, 1303 'parent_id' => $comment_one, 1304 'content' => 'depth 2' 1305 ) ); 1306 1307 $comment_two = bp_activity_new_comment( array( 1308 'user_id' => $u, 1309 'activity_id' => $parent_activity, 1310 'content' => 'depth 1' 1311 ) ); 1312 1313 // Pass empty values to bp_activity_delete_comment() 1314 $retval = bp_activity_delete_comment( 0, 0 ); 1315 $this->assertFalse( $retval ); 1316 1317 // Instantiate activity loop, which also includes activity comments. 1318 bp_has_activities( 'display_comments=stream' ); 1319 1320 // Activity comments should not be deleted. 1321 $this->assertSame( 4, $GLOBALS['activities_template']->activity_count ); 1322 1323 // Clean up after ourselves! 1324 $GLOBALS['activities_template'] = null; 1325 } 1326 1327 /** 1281 1328 * @group bp_activity_new_comment 1282 1329 * @group BP5907
Note: See TracChangeset
for help on using the changeset viewer.