Changeset 12433
- Timestamp:
- 08/12/2019 08:43:58 PM (5 years ago)
- Location:
- trunk
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/bp-groups/actions/create.php
r12126 r12433 137 137 } 138 138 139 groups_send_invites( bp_loggedin_user_id(), $bp->groups->new_group_id);139 groups_send_invites( array( 'group_id' => $bp->groups->new_group_id ) ); 140 140 } 141 141 -
trunk/src/bp-groups/screens/single/send-invites.php
r11935 r12433 32 32 33 33 // Send the invites. 34 groups_send_invites( bp_loggedin_user_id(), $bp->groups->current_group->id);34 groups_send_invites( array( 'group_id' => $bp->groups->current_group->id ) ); 35 35 bp_core_add_message( __('Group invites sent.', 'buddypress') ); 36 36 -
trunk/src/bp-templates/bp-nouveau/includes/groups/ajax.php
r12407 r12433 414 414 415 415 // Send the invites. 416 groups_send_invites( bp_loggedin_user_id(), $group_id);416 groups_send_invites( array( 'group_id' => $group_id ) ); 417 417 418 418 if ( ! empty( $_POST['message'] ) ) { -
trunk/tests/phpunit/testcases/groups/functions/bpGetUserGroups.php
r11739 r12433 27 27 self::$groups = $f->group->create_many( 4, array( 28 28 'creator_id' => self::$admin_user, 29 'status' => 'private' 29 30 ) ); 30 31 … … 70 71 71 72 public function test_is_confirmed_true() { 72 $this->add_user_to_group( self::$user, self::$groups[2], array( 73 groups_send_membership_request( array( 74 'user_id' => self::$user, 75 'group_id' => self::$groups[2] 76 ) ); 77 78 $expected = array( self::$groups[0], self::$groups[1] ); 79 $found = bp_get_user_groups( self::$user, array( 80 'is_confirmed' => true, 81 ) ); 82 83 $this->assertEqualSets( $expected, wp_list_pluck( $found, 'group_id' ) ); 84 } 85 86 public function test_is_confirmed_false() { 87 groups_send_membership_request( array( 88 'user_id' => self::$user, 89 'group_id' => self::$groups[2] 90 ) ); 91 92 $expected = array( self::$groups[2] ); 93 $found = bp_get_user_groups( self::$user, array( 73 94 'is_confirmed' => false, 74 95 ) ); 75 96 76 $expected = array( self::$groups[0], self::$groups[1] );77 $found = bp_get_user_groups( self::$user, array(78 'is_confirmed' => true,79 ) );80 81 $this->assertEqualSets( $expected, wp_list_pluck( $found, 'group_id' ) );82 }83 84 public function test_is_confirmed_false() {85 $this->add_user_to_group( self::$user, self::$groups[2], array(86 'is_confirmed' => false,87 ) );88 89 $expected = array( self::$groups[2] );90 $found = bp_get_user_groups( self::$user, array(91 'is_confirmed' => false,92 ) );93 94 97 $this->assertEqualSets( $expected, wp_list_pluck( $found, 'group_id' ) ); 95 98 } 96 99 97 100 public function test_is_confirmed_null() { 98 $this->add_user_to_group( self::$user, self::$groups[2], array( 99 'is_confirmed' => false, 101 groups_send_membership_request( array( 102 'user_id' => self::$user, 103 'group_id' => self::$groups[2] 100 104 ) ); 101 105 … … 395 399 396 400 groups_invite_user( array( 397 'user_id' => self::$user, 398 'group_id' => self::$groups[2], 399 'inviter_id' => self::$admin_user, 401 'user_id' => self::$user, 402 'group_id' => self::$groups[2], 403 'inviter_id' => self::$admin_user, 404 'send_invite' => 1 400 405 ) ); 401 406 … … 413 418 public function test_cache_should_be_invalidated_on_group_uninvite() { 414 419 groups_invite_user( array( 415 'user_id' => self::$user, 416 'group_id' => self::$groups[2], 417 'inviter_id' => self::$admin_user, 420 'user_id' => self::$user, 421 'group_id' => self::$groups[2], 422 'inviter_id' => self::$admin_user, 423 'send_invite' => 1, 418 424 ) ); 419 425 … … 438 444 public function test_cache_should_be_invalidated_on_group_invite_acceptance() { 439 445 groups_invite_user( array( 440 'user_id' => self::$user, 441 'group_id' => self::$groups[2], 442 'inviter_id' => self::$admin_user, 446 'user_id' => self::$user, 447 'group_id' => self::$groups[2], 448 'inviter_id' => self::$admin_user, 449 'send_invite' => 1 443 450 ) ); 444 451 … … 459 466 public function test_cache_should_be_invalidated_on_group_invite_reject() { 460 467 groups_invite_user( array( 461 'user_id' => self::$user, 462 'group_id' => self::$groups[2], 463 'inviter_id' => self::$admin_user, 468 'user_id' => self::$user, 469 'group_id' => self::$groups[2], 470 'inviter_id' => self::$admin_user, 471 'send_invite' => 1 464 472 ) ); 465 473 … … 484 492 public function test_cache_should_be_invalidated_on_group_invite_delete() { 485 493 groups_invite_user( array( 486 'user_id' => self::$user, 487 'group_id' => self::$groups[2], 488 'inviter_id' => self::$admin_user, 494 'user_id' => self::$user, 495 'group_id' => self::$groups[2], 496 'inviter_id' => self::$admin_user, 497 'send_invite' => 1 489 498 ) ); 490 499 … … 517 526 $_SERVER['SERVER_NAME'] = ''; 518 527 519 groups_send_membership_request( self::$user, self::$groups[2] ); 528 groups_send_membership_request( array( 529 'user_id' => self::$user, 530 'group_id' => self::$groups[2] 531 ) ); 520 532 521 533 // For `wp_mail()`. … … 542 554 $_SERVER['SERVER_NAME'] = ''; 543 555 544 groups_send_membership_request( self::$user, self::$groups[2] ); 556 groups_send_membership_request( array( 557 'user_id' => self::$user, 558 'group_id' => self::$groups[2], 559 ) ); 545 560 546 561 // Populate cache. … … 549 564 $m = new BP_Groups_Member( self::$user, self::$groups[2] ); 550 565 551 groups_accept_membership_request( $m->id, self::$user, self::$groups[2] );566 groups_accept_membership_request( false, self::$user, self::$groups[2] ); 552 567 553 568 // For `wp_mail()`. -
trunk/tests/phpunit/testcases/groups/functions/groupsIsUser.php
r11739 r12433 22 22 self::$groups = $f->group->create_many( 3, array( 23 23 'creator_id' => self::$admin_user, 24 'status' => 'private' 24 25 ) ); 25 26 … … 174 175 'user_id' => self::$user, 175 176 'group_id' => self::$groups[1], 176 'inviter_id' => 123, 177 ) ); 178 179 // Send invite. 180 $m = new BP_Groups_Member( self::$user, self::$groups[1] ); 181 $m->invite_sent = 1; 182 $m->save(); 177 'inviter_id' => self::$admin_user, 178 'send_invite' => 1, 179 ) ); 183 180 184 181 $this->assertNotEmpty( groups_is_user_invited( self::$user, self::$groups[1] ) ); 185 182 } 186 183 187 public function test_groups_is_user_pending_should_return_false_for_ pending_member() {184 public function test_groups_is_user_pending_should_return_false_for_invited_member() { 188 185 groups_invite_user( array( 189 186 'user_id' => self::$user, 190 187 'group_id' => self::$groups[1], 191 'inviter_id' => 123, 192 ) ); 193 194 // Send invite. 195 $m = new BP_Groups_Member( self::$user, self::$groups[1] ); 196 $m->invite_sent = 1; 197 $m->save(); 188 'send_invite' => 1 189 ) ); 198 190 199 191 $this->assertEquals( false, groups_is_user_pending( self::$user, self::$groups[1] ) ); … … 205 197 206 198 public function test_groups_is_user_pending_should_return_true_for_pending_member() { 207 208 $m = new BP_Groups_Member; 209 $m->group_id = self::$groups[1]; 210 $m->user_id = self::$user; 211 $m->inviter_id = 0; 212 $m->is_admin = 0; 213 $m->user_title = ''; 214 $m->date_modified = bp_core_current_time(); 215 $m->is_confirmed = 0; 216 $m->comments = 'request'; 217 $m->save(); 199 groups_send_membership_request( array( 200 'user_id' => self::$user, 201 'group_id' => self::$groups[1], 202 ) ); 218 203 219 204 $this->assertNotEmpty( groups_is_user_pending( self::$user, self::$groups[1] ) ); -
trunk/tests/phpunit/testcases/groups/notifications.php
r11737 r12433 233 233 ) ); 234 234 235 groups_send_membership_request( $users[2], $this->group ); 235 groups_send_membership_request( array( 236 'user_id' => $users[2], 237 'group_id' => $this->group 238 ) ); 236 239 237 240 // Both admins should get a notification. -
trunk/tests/phpunit/testcases/groups/template.php
r11737 r12433 590 590 ) ); 591 591 592 $m2 = $this->add_user_to_group( $u2, $g,array(593 ' date_modified' => gmdate( 'Y-m-d H:i:s', $now - 60*60*24 ),594 ' is_confirmed' => 0,592 groups_invite_user( array( 593 'user_id' => $u2, 594 'group_id' => $g, 595 595 'inviter_id' => $u1, 596 ' invite_sent' => true,597 ) ); 598 599 $m3 = $this->add_user_to_group( $u3, $g,array(600 ' date_modified' => gmdate( 'Y-m-d H:i:s', $now - 60*60*12 ),601 ' is_confirmed' => 0,596 'send_invite' => 1 597 ) ); 598 599 groups_invite_user( array( 600 'user_id' => $u3, 601 'group_id' => $g, 602 602 'inviter_id' => $u1, 603 ' invite_sent' => true,603 'send_invite' => 1 604 604 ) ); 605 605 606 606 $m4 = $this->add_user_to_group( $u4, $g, array( 607 607 'date_modified' => gmdate( 'Y-m-d H:i:s', $now - 60*60*36 ), 608 'is_confirmed' => 1, 609 'inviter_id' => $u1, 610 'invite_sent' => true, 608 'is_confirmed' => 1 611 609 ) ); 612 610 … … 664 662 for ( $i = 1; $i < 6; $i++ ) { 665 663 $users[ $i ] = self::factory()->user->create( array( 666 'last_activity' => gmdate( 'Y-m-d H:i:s', $now - $i ),664 'last_activity' => gmdate( 'Y-m-d H:i:s', $now - $i*60 ), 667 665 ) ); 668 666 669 $ this->add_user_to_group( $users[ $i ], $g,array(670 ' date_modified' => gmdate( 'Y-m-d H:i:s', $now - $i ),671 ' is_confirmed' => 0,667 $inv = groups_invite_user( array( 668 'user_id' => $users[ $i ], 669 'group_id' => $g, 672 670 'inviter_id' => $u1, 673 ' invite_sent' => true,671 'send_invite' => 1 674 672 ) ); 673 674 $invite = new BP_Invitation( $inv ); 675 $invite->date_modified = gmdate( 'Y-m-d H:i:s', $now - $i*60 ); 676 $invite->save(); 675 677 } 676 678 … … 702 704 $g = self::factory()->group->create( array( 703 705 'creator_id' => $u1, 706 'status' => 'private' 704 707 ) ); 705 708 … … 711 714 ) ); 712 715 713 $memberships[ $i ] = $this->add_user_to_group( $users[ $i ], $g, array( 714 // this date_modified ensures that order will match 715 // id order. necessary due to a quirk in the legacy 716 // implementation 717 'date_modified' => gmdate( 'Y-m-d H:i:s', $now - ( 100 - $i ) ), 718 'is_confirmed' => 0, 719 'inviter_id' => 0, 720 'invite_sent' => false, 716 $memberships[ $i ] = groups_send_membership_request( array( 717 'user_id' => $users[ $i ], 718 'group_id' => $g 721 719 ) ); 722 720 } … … 751 749 752 750 $this->assertEquals( $expected_user_ids, wp_list_pluck( $requests_template->requests, 'user_id' ) ); 753 $this->assertEquals( $expected_mem_ids, wp_list_pluck( $requests_template->requests, 'i d' ) );751 $this->assertEquals( $expected_mem_ids, wp_list_pluck( $requests_template->requests, 'invitation_id' ) ); 754 752 } 755 753 … … 767 765 $g = self::factory()->group->create( array( 768 766 'creator_id' => $u1, 767 'status' => 'private' 769 768 ) ); 770 769 … … 775 774 ) ); 776 775 777 $membership = $this->add_user_to_group( $user, $g, array( 778 'date_modified' => gmdate( 'Y-m-d H:i:s', $time ), 779 'is_confirmed' => 0, 780 'inviter_id' => 0, 781 'invite_sent' => false, 776 $membership = groups_send_membership_request( array( 777 'user_id' => $user, 778 'group_id' => $g 782 779 ) ); 783 780 … … 805 802 806 803 $expected = new stdClass; 807 $expected->i d = $membership;804 $expected->invitation_id = $membership; 808 805 $expected->group_id = $g; 809 806 $expected->user_id = $user; … … 816 813 $expected->is_confirmed = '0'; 817 814 $expected->is_banned = '0'; 818 $expected->invite_sent = ' 0';815 $expected->invite_sent = '1'; 819 816 820 817 // Check each expected value. If there are more in the results, -
trunk/tests/phpunit/testcases/groups/template/bpGroupStatusMessage.php
r11737 r12433 99 99 $this->set_current_user( $u ); 100 100 101 groups_send_membership_request( $u, $g ); 101 groups_send_membership_request( array( 102 'user_id' => $u, 103 'group_id' => $g 104 ) ); 102 105 103 106 if ( bp_has_groups( array( 'include' => array( $g ) ) ) ) { … … 142 145 $GLOBALS['groups_template']->group = groups_get_group( $groups[0] ); 143 146 144 groups_send_membership_request( $u, $groups[1] ); 147 groups_send_membership_request( array( 148 'user_id' => $u, 149 'group_id' => $groups[1] 150 ) ); 145 151 146 152 $group1 = groups_get_group( array( -
trunk/tests/phpunit/testcases/groups/user_can.php
r12244 r12433 109 109 ) ); 110 110 $u1 = $this->factory->user->create(); 111 groups_send_membership_request( $u1, $g1 ); 111 groups_send_membership_request( array( 112 'user_id' => $u1, 113 'group_id' => $g1 114 ) ); 112 115 113 116 $this->assertFalse( bp_user_can( $u1, 'groups_request_membership', array( 'group_id' => $g1 ) ) );
Note: See TracChangeset
for help on using the changeset viewer.