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

ReleephRequestStatus

Summary: This is just a bit of gardening in order to make the responsive-UI diff easier; I'll be putting `getColorFor($status)` type things in this class, following the pattern in `ManiphestTaskStatus`.

Test Plan: Poke around Releeph.

Reviewers: epriestley

Reviewed By: epriestley

CC: aran, Korvin

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

+54 -47
+1
src/__phutil_library_map__.php
··· 1742 1742 'ReleephRequestHeaderView' => 'applications/releeph/view/request/header/ReleephRequestHeaderView.php', 1743 1743 'ReleephRequestIntentsView' => 'applications/releeph/view/request/ReleephRequestIntentsView.php', 1744 1744 'ReleephRequestReplyHandler' => 'applications/releeph/mail/ReleephRequestReplyHandler.php', 1745 + 'ReleephRequestStatus' => 'applications/releeph/constants/ReleephRequestStatus.php', 1745 1746 'ReleephRequestStatusView' => 'applications/releeph/view/request/ReleephRequestStatusView.php', 1746 1747 'ReleephRequestTransaction' => 'applications/releeph/storage/ReleephRequestTransaction.php', 1747 1748 'ReleephRequestTransactionComment' => 'applications/releeph/storage/ReleephRequestTransactionComment.php',
+32
src/applications/releeph/constants/ReleephRequestStatus.php
··· 1 + <?php 2 + 3 + final class ReleephRequestStatus { 4 + 5 + const STATUS_REQUESTED = 1; 6 + const STATUS_NEEDS_PICK = 2; // aka approved 7 + const STATUS_REJECTED = 3; 8 + const STATUS_ABANDONED = 4; 9 + const STATUS_PICKED = 5; 10 + const STATUS_REVERTED = 6; 11 + const STATUS_NEEDS_REVERT = 7; // aka revert requested 12 + 13 + public static function getStatusDescriptionFor($status) { 14 + $descriptions = array( 15 + self::STATUS_REQUESTED => pht('Requested'), 16 + self::STATUS_REJECTED => pht('Rejected'), 17 + self::STATUS_ABANDONED => pht('Abandoned'), 18 + self::STATUS_PICKED => pht('Picked'), 19 + self::STATUS_REVERTED => pht('Reverted'), 20 + self::STATUS_NEEDS_PICK => pht('Needs Pick'), 21 + self::STATUS_NEEDS_REVERT => pht('Needs Revert'), 22 + ); 23 + return idx($descriptions, $status, '??'); 24 + } 25 + 26 + public static function getStatusClassSuffixFor($status) { 27 + $description = self::getStatusDescriptionFor($status); 28 + $class = str_replace(' ', '-', strtolower($description)); 29 + return $class; 30 + } 31 + 32 + }
+8 -8
src/applications/releeph/field/specification/ReleephStatusFieldSpecification.php
··· 14 14 } 15 15 16 16 private static $filters = array( 17 - 'req' => ReleephRequest::STATUS_REQUESTED, 18 - 'app' => ReleephRequest::STATUS_NEEDS_PICK, 19 - 'rej' => ReleephRequest::STATUS_REJECTED, 20 - 'abn' => ReleephRequest::STATUS_ABANDONED, 21 - 'mer' => ReleephRequest::STATUS_PICKED, 22 - 'rrq' => ReleephRequest::STATUS_NEEDS_REVERT, 23 - 'rev' => ReleephRequest::STATUS_REVERTED, 17 + 'req' => ReleephRequestStatus::STATUS_REQUESTED, 18 + 'app' => ReleephRequestStatus::STATUS_NEEDS_PICK, 19 + 'rej' => ReleephRequestStatus::STATUS_REJECTED, 20 + 'abn' => ReleephRequestStatus::STATUS_ABANDONED, 21 + 'mer' => ReleephRequestStatus::STATUS_PICKED, 22 + 'rrq' => ReleephRequestStatus::STATUS_NEEDS_REVERT, 23 + 'rev' => ReleephRequestStatus::STATUS_REVERTED, 24 24 ); 25 25 26 26 protected function appendSelectControls( ··· 34 34 ); 35 35 36 36 foreach (self::$filters as $code => $status) { 37 - $name = ReleephRequest::getStatusDescriptionFor($status); 37 + $name = ReleephRequestStatus::getStatusDescriptionFor($status); 38 38 $filter_names[$code] = $name; 39 39 } 40 40
+7 -34
src/applications/releeph/storage/ReleephRequest.php
··· 34 34 const REVERT_OK = 5; 35 35 const REVERT_FAILED = 6; 36 36 37 - const STATUS_REQUESTED = 1; 38 - const STATUS_NEEDS_PICK = 2; // aka approved 39 - const STATUS_REJECTED = 3; 40 - const STATUS_ABANDONED = 4; 41 - const STATUS_PICKED = 5; 42 - const STATUS_REVERTED = 6; 43 - const STATUS_NEEDS_REVERT = 7; // aka revert requested 44 - 45 37 public function shouldBeInBranch() { 46 38 return 47 39 $this->getPusherIntent() == self::INTENT_WANT && ··· 92 84 private function calculateStatus() { 93 85 if ($this->shouldBeInBranch()) { 94 86 if ($this->getInBranch()) { 95 - return self::STATUS_PICKED; 87 + return ReleephRequestStatus::STATUS_PICKED; 96 88 } else { 97 - return self::STATUS_NEEDS_PICK; 89 + return ReleephRequestStatus::STATUS_NEEDS_PICK; 98 90 } 99 91 } else { 100 92 if ($this->getInBranch()) { 101 - return self::STATUS_NEEDS_REVERT; 93 + return ReleephRequestStatus::STATUS_NEEDS_REVERT; 102 94 } else { 103 95 $has_been_in_branch = $this->getCommitIdentifier(); 104 96 // Regardless of why we reverted something, always say reverted if it 105 97 // was once in the branch. 106 98 if ($has_been_in_branch) { 107 - return self::STATUS_REVERTED; 99 + return ReleephRequestStatus::STATUS_REVERTED; 108 100 } elseif ($this->getPusherIntent() === ReleephRequest::INTENT_PASS) { 109 101 // Otherwise, if it has never been in the branch, explicitly say why: 110 - return self::STATUS_REJECTED; 102 + return ReleephRequestStatus::STATUS_REJECTED; 111 103 } elseif ($this->getRequestorIntent() === ReleephRequest::INTENT_WANT) { 112 - return self::STATUS_REQUESTED; 104 + return ReleephRequestStatus::STATUS_REQUESTED; 113 105 } else { 114 - return self::STATUS_ABANDONED; 106 + return ReleephRequestStatus::STATUS_ABANDONED; 115 107 } 116 108 } 117 109 } 118 - } 119 - 120 - public static function getStatusDescriptionFor($status) { 121 - static $descriptions = array( 122 - self::STATUS_REQUESTED => 'Requested', 123 - self::STATUS_REJECTED => 'Rejected', 124 - self::STATUS_ABANDONED => 'Abandoned', 125 - self::STATUS_PICKED => 'Picked', 126 - self::STATUS_REVERTED => 'Reverted', 127 - self::STATUS_NEEDS_PICK => 'Needs Pick', 128 - self::STATUS_NEEDS_REVERT => 'Needs Revert', 129 - ); 130 - return idx($descriptions, $status, '??'); 131 - } 132 - 133 - public static function getStatusClassSuffixFor($status) { 134 - $description = self::getStatusDescriptionFor($status); 135 - $class = str_replace(' ', '-', strtolower($description)); 136 - return $class; 137 110 } 138 111 139 112
+1 -1
src/applications/releeph/view/branch/ReleephBranchBoxView.php
··· 115 115 116 116 $cells = array(); 117 117 foreach ($statistics as $status => $count) { 118 - $description = ReleephRequest::getStatusDescriptionFor($status); 118 + $description = ReleephRequestStatus::getStatusDescriptionFor($status); 119 119 $cells[] = phutil_tag('th', array(), $count); 120 120 $cells[] = phutil_tag('td', array(), $description); 121 121 }
+3 -3
src/applications/releeph/view/request/ReleephRequestStatusView.php
··· 16 16 $status = $request->getStatus(); 17 17 $pick_status = $request->getPickStatus(); 18 18 19 - $description = ReleephRequest::getStatusDescriptionFor($status); 19 + $description = ReleephRequestStatus::getStatusDescriptionFor($status); 20 20 21 21 $warning = null; 22 22 23 - if ($status == ReleephRequest::STATUS_NEEDS_PICK) { 23 + if ($status == ReleephRequestStatus::STATUS_NEEDS_PICK) { 24 24 if ($pick_status == ReleephRequest::PICK_FAILED) { 25 25 $warning = 'Last pick failed!'; 26 26 } 27 - } elseif ($status == ReleephRequest::STATUS_NEEDS_REVERT) { 27 + } elseif ($status == ReleephRequestStatus::STATUS_NEEDS_REVERT) { 28 28 if ($pick_status == ReleephRequest::REVERT_FAILED) { 29 29 $warning = 'Last revert failed!'; 30 30 }
+2 -1
src/applications/releeph/view/request/header/ReleephRequestHeaderView.php
··· 55 55 $rr_div_class = 56 56 'releeph-request-header '. 57 57 'releeph-request-header-border '. 58 - 'releeph-border-color-'.ReleephRequest::getStatusClassSuffixFor($status); 58 + 'releeph-border-color-'. 59 + ReleephRequestStatus::getStatusClassSuffixFor($status); 59 60 60 61 $hidden_link = phutil_tag( 61 62 'a',