@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.) hq.recaptime.dev/wiki/Phorge
phorge phabricator
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Remove CAN_JOIN policy from Conpherence

Summary: Fixes T12178, Fixes T11704 Not sure this feature gets any use and I can't find a similar option in other software, so removing it I think simiplifies a number of things. Removes CAN_JOIN and joinable is basically now CAN_VIEW and !$participating. Also removed some old transaction strings for other policies. Don't seem used.

Test Plan: Create a new room, edit room policies, see changes. Log into second account, search for rooms, everything now is visible.

Reviewers: epriestley

Reviewed By: epriestley

Subscribers: Korvin

Maniphest Tasks: T12178, T11704

Differential Revision: https://secure.phabricator.com/D17675

+10 -104
+1 -5
src/applications/conpherence/controller/ConpherenceController.php
··· 78 78 } 79 79 80 80 $participating = $conpherence->getParticipantIfExists($viewer->getPHID()); 81 - $can_join = PhabricatorPolicyFilter::hasCapability( 82 - $viewer, 83 - $conpherence, 84 - PhabricatorPolicyCapability::CAN_JOIN); 85 81 86 82 $header->addActionItem( 87 83 id(new PHUIIconCircleView()) ··· 129 125 ->setColor('green') 130 126 ->addClass('conpherence-search-toggle')); 131 127 132 - if ($can_join && !$participating) { 128 + if (!$participating) { 133 129 $action = ConpherenceUpdateActions::JOIN_ROOM; 134 130 $uri = $this->getApplicationURI('update/'.$conpherence->getID().'/'); 135 131 $button = phutil_tag(
-10
src/applications/conpherence/controller/ConpherenceNewRoomController.php
··· 34 34 $xactions[] = id(new ConpherenceTransaction()) 35 35 ->setTransactionType(PhabricatorTransactions::TYPE_EDIT_POLICY) 36 36 ->setNewValue($request->getStr('editPolicy')); 37 - $xactions[] = id(new ConpherenceTransaction()) 38 - ->setTransactionType(PhabricatorTransactions::TYPE_JOIN_POLICY) 39 - ->setNewValue($request->getStr('joinPolicy')); 40 37 41 38 try { 42 39 $editor ··· 55 52 56 53 $conpherence->setViewPolicy($request->getStr('viewPolicy')); 57 54 $conpherence->setEditPolicy($request->getStr('editPolicy')); 58 - $conpherence->setJoinPolicy($request->getStr('joinPolicy')); 59 55 } 60 56 } else { 61 57 if ($request->getStr('participant')) { ··· 110 106 ->setName('editPolicy') 111 107 ->setPolicyObject($conpherence) 112 108 ->setCapability(PhabricatorPolicyCapability::CAN_EDIT) 113 - ->setPolicies($policies)) 114 - ->appendChild( 115 - id(new AphrontFormPolicyControl()) 116 - ->setName('joinPolicy') 117 - ->setPolicyObject($conpherence) 118 - ->setCapability(PhabricatorPolicyCapability::CAN_JOIN) 119 109 ->setPolicies($policies)); 120 110 121 111 $dialog->appendChild($form);
+1 -20
src/applications/conpherence/controller/ConpherenceUpdateController.php
··· 24 24 case ConpherenceUpdateActions::METADATA: 25 25 $needed_capabilities[] = PhabricatorPolicyCapability::CAN_EDIT; 26 26 break; 27 - case ConpherenceUpdateActions::JOIN_ROOM: 28 - $needed_capabilities[] = PhabricatorPolicyCapability::CAN_JOIN; 29 - break; 30 27 case ConpherenceUpdateActions::NOTIFICATIONS: 31 28 $need_participants = true; 32 29 break; ··· 153 150 $xactions[] = id(new ConpherenceTransaction()) 154 151 ->setTransactionType(PhabricatorTransactions::TYPE_EDIT_POLICY) 155 152 ->setNewValue($request->getStr('editPolicy')); 156 - $xactions[] = id(new ConpherenceTransaction()) 157 - ->setTransactionType(PhabricatorTransactions::TYPE_JOIN_POLICY) 158 - ->setNewValue($request->getStr('joinPolicy')); 159 153 if (!$request->getExists('force_ajax')) { 160 154 $response_mode = 'redirect'; 161 155 } ··· 256 250 257 251 $participant = $conpherence->getParticipantIfExists($user->getPHID()); 258 252 if (!$participant) { 259 - $can_join = PhabricatorPolicyFilter::hasCapability( 260 - $user, 261 - $conpherence, 262 - PhabricatorPolicyCapability::CAN_JOIN); 263 - if ($can_join) { 253 + if ($user->isLoggedIn()) { 264 254 $text = pht( 265 255 'Notification settings are available after joining the room.'); 266 - } else if ($user->isLoggedIn()) { 267 - $text = pht( 268 - 'Notification settings not applicable to rooms you can not join.'); 269 256 } else { 270 257 $text = pht( 271 258 'Notification settings are available after logging in and joining '. ··· 459 446 ->setName('editPolicy') 460 447 ->setPolicyObject($conpherence) 461 448 ->setCapability(PhabricatorPolicyCapability::CAN_EDIT) 462 - ->setPolicies($policies)) 463 - ->appendChild( 464 - id(new AphrontFormPolicyControl()) 465 - ->setName('joinPolicy') 466 - ->setPolicyObject($conpherence) 467 - ->setCapability(PhabricatorPolicyCapability::CAN_JOIN) 468 449 ->setPolicies($policies)); 469 450 470 451 $view = id(new AphrontDialogView())
+2 -10
src/applications/conpherence/controller/ConpherenceViewController.php
··· 119 119 return id(new AphrontAjaxResponse())->setContent($content); 120 120 } 121 121 122 - $can_join = PhabricatorPolicyFilter::hasCapability( 123 - $user, 124 - $conpherence, 125 - PhabricatorPolicyCapability::CAN_JOIN); 126 - 127 122 $layout = id(new ConpherenceLayoutView()) 128 123 ->setUser($user) 129 124 ->setBaseURI($this->getApplicationURI()) ··· 151 146 152 147 $conpherence = $this->getConpherence(); 153 148 $user = $this->getRequest()->getUser(); 154 - $can_join = PhabricatorPolicyFilter::hasCapability( 155 - $user, 156 - $conpherence, 157 - PhabricatorPolicyCapability::CAN_JOIN); 149 + 158 150 $participating = $conpherence->getParticipantIfExists($user->getPHID()); 159 - if (!$can_join && !$participating && $user->isLoggedIn()) { 151 + if (!$participating && $user->isLoggedIn()) { 160 152 return null; 161 153 } 162 154 $draft = PhabricatorDraft::newFromUserAndKey(
+5 -18
src/applications/conpherence/editor/ConpherenceEditor.php
··· 92 92 $types[] = PhabricatorTransactions::TYPE_COMMENT; 93 93 $types[] = PhabricatorTransactions::TYPE_VIEW_POLICY; 94 94 $types[] = PhabricatorTransactions::TYPE_EDIT_POLICY; 95 - $types[] = PhabricatorTransactions::TYPE_JOIN_POLICY; 96 95 97 96 return $types; 98 97 } ··· 383 382 384 383 $actor_phid = $this->requireActor()->getPHID(); 385 384 386 - $is_join = (($add === array($actor_phid)) && !$rem); 387 - $is_leave = (($rem === array($actor_phid)) && !$add); 385 + // You need CAN_EDIT to change participants other than yourself. 386 + PhabricatorPolicyFilter::requireCapability( 387 + $this->requireActor(), 388 + $object, 389 + PhabricatorPolicyCapability::CAN_EDIT); 388 390 389 - if ($is_join) { 390 - // You need CAN_JOIN to join a room. 391 - PhabricatorPolicyFilter::requireCapability( 392 - $this->requireActor(), 393 - $object, 394 - PhabricatorPolicyCapability::CAN_JOIN); 395 - } else if ($is_leave) { 396 - // You don't need any capabilities to leave a conpherence thread. 397 - } else { 398 - // You need CAN_EDIT to change participants other than yourself. 399 - PhabricatorPolicyFilter::requireCapability( 400 - $this->requireActor(), 401 - $object, 402 - PhabricatorPolicyCapability::CAN_EDIT); 403 - } 404 391 break; 405 392 case ConpherenceThreadTitleTransaction::TRANSACTIONTYPE: 406 393 case ConpherenceThreadTopicTransaction::TRANSACTIONTYPE:
+1 -5
src/applications/conpherence/storage/ConpherenceThread.php
··· 33 33 ->attachParticipants(array()) 34 34 ->setViewPolicy($default_policy) 35 35 ->setEditPolicy($default_policy) 36 - ->setJoinPolicy($default_policy); 36 + ->setJoinPolicy(''); 37 37 } 38 38 39 39 protected function getConfiguration() { ··· 298 298 return array( 299 299 PhabricatorPolicyCapability::CAN_VIEW, 300 300 PhabricatorPolicyCapability::CAN_EDIT, 301 - PhabricatorPolicyCapability::CAN_JOIN, 302 301 ); 303 302 } 304 303 ··· 308 307 return $this->getViewPolicy(); 309 308 case PhabricatorPolicyCapability::CAN_EDIT: 310 309 return $this->getEditPolicy(); 311 - case PhabricatorPolicyCapability::CAN_JOIN: 312 - return $this->getJoinPolicy(); 313 310 } 314 311 return PhabricatorPolicies::POLICY_NOONE; 315 312 } ··· 322 319 323 320 switch ($capability) { 324 321 case PhabricatorPolicyCapability::CAN_EDIT: 325 - case PhabricatorPolicyCapability::CAN_JOIN: 326 322 return false; 327 323 } 328 324
-36
src/applications/conpherence/storage/ConpherenceTransaction.php
··· 53 53 $new = $this->getNewValue(); 54 54 55 55 switch ($this->getTransactionType()) { 56 - case PhabricatorTransactions::TYPE_VIEW_POLICY: 57 - case PhabricatorTransactions::TYPE_EDIT_POLICY: 58 - case PhabricatorTransactions::TYPE_JOIN_POLICY: 59 - return $this->getRoomTitle(); 60 - break; 61 56 case self::TYPE_PARTICIPANTS: 62 57 $add = array_diff($new, $old); 63 58 $rem = array_diff($old, $new); ··· 88 83 } 89 84 90 85 return parent::getTitle(); 91 - } 92 - 93 - private function getRoomTitle() { 94 - $author_phid = $this->getAuthorPHID(); 95 - 96 - $old = $this->getOldValue(); 97 - $new = $this->getNewValue(); 98 - 99 - switch ($this->getTransactionType()) { 100 - case PhabricatorTransactions::TYPE_VIEW_POLICY: 101 - return pht( 102 - '%s changed the visibility of this room from "%s" to "%s".', 103 - $this->renderHandleLink($author_phid), 104 - $this->renderPolicyName($old, 'old'), 105 - $this->renderPolicyName($new, 'new')); 106 - break; 107 - case PhabricatorTransactions::TYPE_EDIT_POLICY: 108 - return pht( 109 - '%s changed the edit policy of this room from "%s" to "%s".', 110 - $this->renderHandleLink($author_phid), 111 - $this->renderPolicyName($old, 'old'), 112 - $this->renderPolicyName($new, 'new')); 113 - break; 114 - case PhabricatorTransactions::TYPE_JOIN_POLICY: 115 - return pht( 116 - '%s changed the join policy of this room from "%s" to "%s".', 117 - $this->renderHandleLink($author_phid), 118 - $this->renderPolicyName($old, 'old'), 119 - $this->renderPolicyName($new, 'new')); 120 - break; 121 - } 122 86 } 123 87 124 88 public function getRequiredHandlePHIDs() {