@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.

Releeph s/isPusher/isAuthoritative/

Summary: Instead of being able to ask if someone was a pusher or not, ask if they are "authoritative" enough to make decisions about Releeph requests. A person is authoritative if a project has pushers, and they are a pusher, or in the case of pusher-less projects, everyone is authoritative.

Test Plan: Make a request in a project with no pushers (it is immediately ready to be picked) and a project with pushers (where it requires approval.)

Reviewers: wez, epriestley

Reviewed By: epriestley

CC: epriestley, aran

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

+20 -18
+2 -7
src/applications/releeph/conduit/work/ConduitAPI_releephwork_canpush_Method.php
··· 28 28 protected function execute(ConduitAPIRequest $request) { 29 29 $releeph_project = id(new ReleephProject()) 30 30 ->loadOneWhere('phid = %s', $request->getValue('projectPHID')); 31 - 32 - if (!$releeph_project->getPushers()) { 33 - return true; 34 - } else { 35 - $user = $request->getUser(); 36 - return $releeph_project->isPusher($user); 37 - } 31 + $user = $request->getUser(); 32 + return $releeph_project->isAuthoritative($user); 38 33 } 39 34 }
+14 -5
src/applications/releeph/storage/ReleephProject.php
··· 94 94 return $this->getDetail('pushers', array()); 95 95 } 96 96 97 - public function isPusherPHID($phid) { 98 - $pusher_phids = $this->getDetail('pushers', array()); 99 - return in_array($phid, $pusher_phids); 97 + public function isPusher(PhabricatorUser $user) { 98 + // TODO Deprecate this once `isPusher` is out of the Facebook codebase. 99 + return $this->isAuthoritative($user); 100 + } 101 + 102 + public function isAuthoritative(PhabricatorUser $user) { 103 + return $this->isAuthoritativePHID($user->getPHID()); 100 104 } 101 105 102 - public function isPusher(PhabricatorUser $user) { 103 - return $this->isPusherPHID($user->getPHID()); 106 + public function isAuthoritativePHID($phid) { 107 + $pushers = $this->getPushers(); 108 + if (!$pushers) { 109 + return true; 110 + } else { 111 + return in_array($phid, $pushers); 112 + } 104 113 } 105 114 106 115 public function loadPhabricatorRepository() {
+1 -1
src/applications/releeph/storage/ReleephRequest.php
··· 65 65 66 66 $found_pusher_want = false; 67 67 foreach ($this->userIntents as $phid => $intent) { 68 - if ($project->isPusherPHID($phid)) { 68 + if ($project->isAuthoritativePHID($phid)) { 69 69 if ($intent == self::INTENT_PASS) { 70 70 return self::INTENT_PASS; 71 71 }
+1 -1
src/applications/releeph/view/branch/ReleephBranchBoxView.php
··· 187 187 188 188 $releeph_project = $br->loadReleephProject(); 189 189 if (!$releeph_project->getPushers() || 190 - $releeph_project->isPusher($this->user)) { 190 + $releeph_project->isAuthoritative($this->user)) { 191 191 192 192 $buttons[] = phutil_tag( 193 193 'a',
+1 -3
src/applications/releeph/view/request/ReleephRequestIntentsView.php
··· 44 44 $intents = $request->getUserIntents(); 45 45 foreach ($intents as $user_phid => $user_intent) { 46 46 if ($user_intent == $render_intent) { 47 - $is_pusher = $project->isPusherPHID($user_phid); 48 - 49 - if ($is_pusher) { 47 + if ($project->isAuthoritativePHID($user_phid)) { 50 48 $pusher_links[] = phutil_tag( 51 49 'span', 52 50 array(
+1 -1
src/applications/releeph/view/request/header/ReleephRequestHeaderView.php
··· 225 225 $right_buttons = array(); 226 226 227 227 $user_phid = $this->user->getPHID(); 228 - $is_pusher = $this->releephProject->isPusherPHID($user_phid); 228 + $is_pusher = $this->releephProject->isAuthoritativePHID($user_phid); 229 229 $is_requestor = $this->releephRequest->getRequestUserPHID() === $user_phid; 230 230 231 231 $current_intent = idx(