diff --git a/src/applications/conpherence/controller/ConpherenceController.php b/src/applications/conpherence/controller/ConpherenceController.php index e6690a55d1..09708b7148 100644 --- a/src/applications/conpherence/controller/ConpherenceController.php +++ b/src/applications/conpherence/controller/ConpherenceController.php @@ -78,10 +78,6 @@ abstract class ConpherenceController extends PhabricatorController { } $participating = $conpherence->getParticipantIfExists($viewer->getPHID()); - $can_join = PhabricatorPolicyFilter::hasCapability( - $viewer, - $conpherence, - PhabricatorPolicyCapability::CAN_JOIN); $header->addActionItem( id(new PHUIIconCircleView()) @@ -129,7 +125,7 @@ abstract class ConpherenceController extends PhabricatorController { ->setColor('green') ->addClass('conpherence-search-toggle')); - if ($can_join && !$participating) { + if (!$participating) { $action = ConpherenceUpdateActions::JOIN_ROOM; $uri = $this->getApplicationURI('update/'.$conpherence->getID().'/'); $button = phutil_tag( diff --git a/src/applications/conpherence/controller/ConpherenceNewRoomController.php b/src/applications/conpherence/controller/ConpherenceNewRoomController.php index 1f27a6807e..d70395dbc9 100644 --- a/src/applications/conpherence/controller/ConpherenceNewRoomController.php +++ b/src/applications/conpherence/controller/ConpherenceNewRoomController.php @@ -34,9 +34,6 @@ final class ConpherenceNewRoomController extends ConpherenceController { $xactions[] = id(new ConpherenceTransaction()) ->setTransactionType(PhabricatorTransactions::TYPE_EDIT_POLICY) ->setNewValue($request->getStr('editPolicy')); - $xactions[] = id(new ConpherenceTransaction()) - ->setTransactionType(PhabricatorTransactions::TYPE_JOIN_POLICY) - ->setNewValue($request->getStr('joinPolicy')); try { $editor @@ -55,7 +52,6 @@ final class ConpherenceNewRoomController extends ConpherenceController { $conpherence->setViewPolicy($request->getStr('viewPolicy')); $conpherence->setEditPolicy($request->getStr('editPolicy')); - $conpherence->setJoinPolicy($request->getStr('joinPolicy')); } } else { if ($request->getStr('participant')) { @@ -110,12 +106,6 @@ final class ConpherenceNewRoomController extends ConpherenceController { ->setName('editPolicy') ->setPolicyObject($conpherence) ->setCapability(PhabricatorPolicyCapability::CAN_EDIT) - ->setPolicies($policies)) - ->appendChild( - id(new AphrontFormPolicyControl()) - ->setName('joinPolicy') - ->setPolicyObject($conpherence) - ->setCapability(PhabricatorPolicyCapability::CAN_JOIN) ->setPolicies($policies)); $dialog->appendChild($form); diff --git a/src/applications/conpherence/controller/ConpherenceUpdateController.php b/src/applications/conpherence/controller/ConpherenceUpdateController.php index 44e6c3cf4b..b8ebe5a826 100644 --- a/src/applications/conpherence/controller/ConpherenceUpdateController.php +++ b/src/applications/conpherence/controller/ConpherenceUpdateController.php @@ -24,9 +24,6 @@ final class ConpherenceUpdateController case ConpherenceUpdateActions::METADATA: $needed_capabilities[] = PhabricatorPolicyCapability::CAN_EDIT; break; - case ConpherenceUpdateActions::JOIN_ROOM: - $needed_capabilities[] = PhabricatorPolicyCapability::CAN_JOIN; - break; case ConpherenceUpdateActions::NOTIFICATIONS: $need_participants = true; break; @@ -153,9 +150,6 @@ final class ConpherenceUpdateController $xactions[] = id(new ConpherenceTransaction()) ->setTransactionType(PhabricatorTransactions::TYPE_EDIT_POLICY) ->setNewValue($request->getStr('editPolicy')); - $xactions[] = id(new ConpherenceTransaction()) - ->setTransactionType(PhabricatorTransactions::TYPE_JOIN_POLICY) - ->setNewValue($request->getStr('joinPolicy')); if (!$request->getExists('force_ajax')) { $response_mode = 'redirect'; } @@ -256,16 +250,9 @@ final class ConpherenceUpdateController $participant = $conpherence->getParticipantIfExists($user->getPHID()); if (!$participant) { - $can_join = PhabricatorPolicyFilter::hasCapability( - $user, - $conpherence, - PhabricatorPolicyCapability::CAN_JOIN); - if ($can_join) { + if ($user->isLoggedIn()) { $text = pht( 'Notification settings are available after joining the room.'); - } else if ($user->isLoggedIn()) { - $text = pht( - 'Notification settings not applicable to rooms you can not join.'); } else { $text = pht( 'Notification settings are available after logging in and joining '. @@ -459,12 +446,6 @@ final class ConpherenceUpdateController ->setName('editPolicy') ->setPolicyObject($conpherence) ->setCapability(PhabricatorPolicyCapability::CAN_EDIT) - ->setPolicies($policies)) - ->appendChild( - id(new AphrontFormPolicyControl()) - ->setName('joinPolicy') - ->setPolicyObject($conpherence) - ->setCapability(PhabricatorPolicyCapability::CAN_JOIN) ->setPolicies($policies)); $view = id(new AphrontDialogView()) diff --git a/src/applications/conpherence/controller/ConpherenceViewController.php b/src/applications/conpherence/controller/ConpherenceViewController.php index 1fbb338822..57fe194845 100644 --- a/src/applications/conpherence/controller/ConpherenceViewController.php +++ b/src/applications/conpherence/controller/ConpherenceViewController.php @@ -119,11 +119,6 @@ final class ConpherenceViewController extends return id(new AphrontAjaxResponse())->setContent($content); } - $can_join = PhabricatorPolicyFilter::hasCapability( - $user, - $conpherence, - PhabricatorPolicyCapability::CAN_JOIN); - $layout = id(new ConpherenceLayoutView()) ->setUser($user) ->setBaseURI($this->getApplicationURI()) @@ -151,12 +146,9 @@ final class ConpherenceViewController extends $conpherence = $this->getConpherence(); $user = $this->getRequest()->getUser(); - $can_join = PhabricatorPolicyFilter::hasCapability( - $user, - $conpherence, - PhabricatorPolicyCapability::CAN_JOIN); + $participating = $conpherence->getParticipantIfExists($user->getPHID()); - if (!$can_join && !$participating && $user->isLoggedIn()) { + if (!$participating && $user->isLoggedIn()) { return null; } $draft = PhabricatorDraft::newFromUserAndKey( diff --git a/src/applications/conpherence/editor/ConpherenceEditor.php b/src/applications/conpherence/editor/ConpherenceEditor.php index 2026eb94c4..e4728f3c00 100644 --- a/src/applications/conpherence/editor/ConpherenceEditor.php +++ b/src/applications/conpherence/editor/ConpherenceEditor.php @@ -92,7 +92,6 @@ final class ConpherenceEditor extends PhabricatorApplicationTransactionEditor { $types[] = PhabricatorTransactions::TYPE_COMMENT; $types[] = PhabricatorTransactions::TYPE_VIEW_POLICY; $types[] = PhabricatorTransactions::TYPE_EDIT_POLICY; - $types[] = PhabricatorTransactions::TYPE_JOIN_POLICY; return $types; } @@ -383,24 +382,12 @@ final class ConpherenceEditor extends PhabricatorApplicationTransactionEditor { $actor_phid = $this->requireActor()->getPHID(); - $is_join = (($add === array($actor_phid)) && !$rem); - $is_leave = (($rem === array($actor_phid)) && !$add); + // You need CAN_EDIT to change participants other than yourself. + PhabricatorPolicyFilter::requireCapability( + $this->requireActor(), + $object, + PhabricatorPolicyCapability::CAN_EDIT); - if ($is_join) { - // You need CAN_JOIN to join a room. - PhabricatorPolicyFilter::requireCapability( - $this->requireActor(), - $object, - PhabricatorPolicyCapability::CAN_JOIN); - } else if ($is_leave) { - // You don't need any capabilities to leave a conpherence thread. - } else { - // You need CAN_EDIT to change participants other than yourself. - PhabricatorPolicyFilter::requireCapability( - $this->requireActor(), - $object, - PhabricatorPolicyCapability::CAN_EDIT); - } break; case ConpherenceThreadTitleTransaction::TRANSACTIONTYPE: case ConpherenceThreadTopicTransaction::TRANSACTIONTYPE: diff --git a/src/applications/conpherence/storage/ConpherenceThread.php b/src/applications/conpherence/storage/ConpherenceThread.php index 17a3de6c50..db6d4a7e61 100644 --- a/src/applications/conpherence/storage/ConpherenceThread.php +++ b/src/applications/conpherence/storage/ConpherenceThread.php @@ -33,7 +33,7 @@ final class ConpherenceThread extends ConpherenceDAO ->attachParticipants(array()) ->setViewPolicy($default_policy) ->setEditPolicy($default_policy) - ->setJoinPolicy($default_policy); + ->setJoinPolicy(''); } protected function getConfiguration() { @@ -298,7 +298,6 @@ final class ConpherenceThread extends ConpherenceDAO return array( PhabricatorPolicyCapability::CAN_VIEW, PhabricatorPolicyCapability::CAN_EDIT, - PhabricatorPolicyCapability::CAN_JOIN, ); } @@ -308,8 +307,6 @@ final class ConpherenceThread extends ConpherenceDAO return $this->getViewPolicy(); case PhabricatorPolicyCapability::CAN_EDIT: return $this->getEditPolicy(); - case PhabricatorPolicyCapability::CAN_JOIN: - return $this->getJoinPolicy(); } return PhabricatorPolicies::POLICY_NOONE; } @@ -322,7 +319,6 @@ final class ConpherenceThread extends ConpherenceDAO switch ($capability) { case PhabricatorPolicyCapability::CAN_EDIT: - case PhabricatorPolicyCapability::CAN_JOIN: return false; } diff --git a/src/applications/conpherence/storage/ConpherenceTransaction.php b/src/applications/conpherence/storage/ConpherenceTransaction.php index b449037235..c692dffb98 100644 --- a/src/applications/conpherence/storage/ConpherenceTransaction.php +++ b/src/applications/conpherence/storage/ConpherenceTransaction.php @@ -53,11 +53,6 @@ final class ConpherenceTransaction $new = $this->getNewValue(); switch ($this->getTransactionType()) { - case PhabricatorTransactions::TYPE_VIEW_POLICY: - case PhabricatorTransactions::TYPE_EDIT_POLICY: - case PhabricatorTransactions::TYPE_JOIN_POLICY: - return $this->getRoomTitle(); - break; case self::TYPE_PARTICIPANTS: $add = array_diff($new, $old); $rem = array_diff($old, $new); @@ -90,37 +85,6 @@ final class ConpherenceTransaction return parent::getTitle(); } - private function getRoomTitle() { - $author_phid = $this->getAuthorPHID(); - - $old = $this->getOldValue(); - $new = $this->getNewValue(); - - switch ($this->getTransactionType()) { - case PhabricatorTransactions::TYPE_VIEW_POLICY: - return pht( - '%s changed the visibility of this room from "%s" to "%s".', - $this->renderHandleLink($author_phid), - $this->renderPolicyName($old, 'old'), - $this->renderPolicyName($new, 'new')); - break; - case PhabricatorTransactions::TYPE_EDIT_POLICY: - return pht( - '%s changed the edit policy of this room from "%s" to "%s".', - $this->renderHandleLink($author_phid), - $this->renderPolicyName($old, 'old'), - $this->renderPolicyName($new, 'new')); - break; - case PhabricatorTransactions::TYPE_JOIN_POLICY: - return pht( - '%s changed the join policy of this room from "%s" to "%s".', - $this->renderHandleLink($author_phid), - $this->renderPolicyName($old, 'old'), - $this->renderPolicyName($new, 'new')); - break; - } - } - public function getRequiredHandlePHIDs() { $phids = parent::getRequiredHandlePHIDs();