diff --git a/src/applications/conpherence/__tests__/ConpherenceRoomTestCase.php b/src/applications/conpherence/__tests__/ConpherenceRoomTestCase.php --- a/src/applications/conpherence/__tests__/ConpherenceRoomTestCase.php +++ b/src/applications/conpherence/__tests__/ConpherenceRoomTestCase.php @@ -100,6 +100,32 @@ $conpherence->getRecentParticipantPHIDs()); } + public function testRoomParticipantDeletion() { + $creator = $this->generateNewTestUser(); + $friend_1 = $this->generateNewTestUser(); + $friend_2 = $this->generateNewTestUser(); + $friend_3 = $this->generateNewTestUser(); + + $participant_map = array( + $creator->getPHID() => $creator, + $friend_1->getPHID() => $friend_1, + $friend_2->getPHID() => $friend_2, + $friend_3->getPHID() => $friend_3, + ); + + $conpherence = $this->createRoom( + $creator, + array_keys($participant_map)); + + foreach ($participant_map as $phid => $user) { + $this->removeParticipants($user, $conpherence, array($phid)); + unset($participant_map[$phid]); + $this->assertEqual( + count($participant_map), + count($conpherence->getParticipants())); + } + } + private function createRoom( PhabricatorUser $creator, array $participant_phids) { diff --git a/src/applications/conpherence/__tests__/ConpherenceTestCase.php b/src/applications/conpherence/__tests__/ConpherenceTestCase.php --- a/src/applications/conpherence/__tests__/ConpherenceTestCase.php +++ b/src/applications/conpherence/__tests__/ConpherenceTestCase.php @@ -17,4 +17,19 @@ } + protected function removeParticipants( + PhabricatorUser $actor, + ConpherenceThread $conpherence, + array $participant_phids) { + + $xactions = array(id(new ConpherenceTransaction()) + ->setTransactionType(ConpherenceTransactionType::TYPE_PARTICIPANTS) + ->setNewValue(array('-' => $participant_phids)),); + $editor = id(new ConpherenceEditor()) + ->setActor($actor) + ->setContentSource(PhabricatorContentSource::newConsoleSource()) + ->applyTransactions($conpherence, $xactions); + } + + } diff --git a/src/applications/conpherence/__tests__/ConpherenceThreadTestCase.php b/src/applications/conpherence/__tests__/ConpherenceThreadTestCase.php --- a/src/applications/conpherence/__tests__/ConpherenceThreadTestCase.php +++ b/src/applications/conpherence/__tests__/ConpherenceThreadTestCase.php @@ -86,6 +86,32 @@ $conpherence->getRecentParticipantPHIDs()); } + public function testThreadParticipantDeletion() { + $creator = $this->generateNewTestUser(); + $friend_1 = $this->generateNewTestUser(); + $friend_2 = $this->generateNewTestUser(); + $friend_3 = $this->generateNewTestUser(); + + $participant_map = array( + $creator->getPHID() => $creator, + $friend_1->getPHID() => $friend_1, + $friend_2->getPHID() => $friend_2, + $friend_3->getPHID() => $friend_3, + ); + + $conpherence = $this->createThread( + $creator, + array_keys($participant_map)); + + foreach ($participant_map as $phid => $user) { + $this->removeParticipants($user, $conpherence, array($phid)); + unset($participant_map[$phid]); + $this->assertEqual( + count($participant_map), + count($conpherence->getParticipants())); + } + } + private function createThread( PhabricatorUser $creator, array $participant_phids) { diff --git a/src/applications/conpherence/controller/ConpherenceNewController.php b/src/applications/conpherence/controller/ConpherenceNewController.php --- a/src/applications/conpherence/controller/ConpherenceNewController.php +++ b/src/applications/conpherence/controller/ConpherenceNewController.php @@ -2,8 +2,7 @@ final class ConpherenceNewController extends ConpherenceController { - public function processRequest() { - $request = $this->getRequest(); + public function handleRequest(AphrontRequest $request) { $user = $request->getUser(); $title = pht('New Message'); diff --git a/src/applications/conpherence/controller/ConpherenceNotificationPanelController.php b/src/applications/conpherence/controller/ConpherenceNotificationPanelController.php --- a/src/applications/conpherence/controller/ConpherenceNotificationPanelController.php +++ b/src/applications/conpherence/controller/ConpherenceNotificationPanelController.php @@ -3,8 +3,7 @@ final class ConpherenceNotificationPanelController extends ConpherenceController { - public function processRequest() { - $request = $this->getRequest(); + public function handleRequest(AphrontRequest $request) { $user = $request->getUser(); $conpherences = array(); $unread_status = ConpherenceParticipationStatus::BEHIND;