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

Store "resigned" as an explicit reviewer state

Summary:
Fixes T11050. Today, when a user resigns, we just delete the record of them ever being a reviewer.

However, this means you have no way to say "I don't care about this and don't want to see it on my dashboard" if you are a member of any project or package reviewers.

Instead, store "resigned" as a distinct state from "not a reviewer", and treat it a little differently in the UI:

- On the bucketing screen, discard revisions any responsible user has resigned from.
- On the main `/Dxxx` page, show these users as resigned explicitly (we could just hide them, too, but I think this is good to start with).
- In the query, don't treat a "resigned" state as a real "reviewer" (this change happened earlier, in D17517).
- When resigning, write a "resigned" state instead of deleting the row.
- When editing a list of reviewers, I'm still treating this reviewer as a reviewer and not special casing it. I think that's sufficiently clear but we could tailor this behavior later.

Test Plan:
- Resigned from a revision.
- Saw "Resigned" in reviewers list.
- Saw revision disappear from my dashboard.
- Edited revision, saw user still appear as an editable reviewer. Saved revision, saw no weird side effects.

Reviewers: chad

Reviewed By: chad

Maniphest Tasks: T11050

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

+60 -11
+29
src/applications/differential/query/DifferentialRevisionRequiredActionResultBucket.php
··· 29 29 } 30 30 $phids = array_fuse($phids); 31 31 32 + // Before continuing, throw away any revisions which responsible users 33 + // have explicitly resigned from. 34 + 35 + // The goal is to allow users to resign from revisions they don't want to 36 + // review to get these revisions off their dashboard, even if there are 37 + // other project or package reviewers which they have authority over. 38 + $this->filterResigned($phids); 39 + 32 40 $groups = array(); 33 41 34 42 $groups[] = $this->newGroup() ··· 219 227 $results = array(); 220 228 foreach ($objects as $key => $object) { 221 229 if (!isset($statuses[$object->getStatus()])) { 230 + continue; 231 + } 232 + 233 + $results[$key] = $object; 234 + unset($this->objects[$key]); 235 + } 236 + 237 + return $results; 238 + } 239 + 240 + private function filterResigned(array $phids) { 241 + $resigned = array( 242 + DifferentialReviewerStatus::STATUS_RESIGNED, 243 + ); 244 + $resigned = array_fuse($resigned); 245 + 246 + $objects = $this->getRevisionsNotAuthored($this->objects, $phids); 247 + 248 + $results = array(); 249 + foreach ($objects as $key => $object) { 250 + if (!$this->hasReviewersWithStatus($object, $phids, $resigned)) { 222 251 continue; 223 252 } 224 253
+5
src/applications/differential/storage/DifferentialReviewer.php
··· 42 42 return $this->assertAttachedKey($this->authority, $cache_fragment); 43 43 } 44 44 45 + public function isResigned() { 46 + $status_resigned = DifferentialReviewerStatus::STATUS_RESIGNED; 47 + return ($this->getReviewerStatus() == $status_resigned); 48 + } 49 + 45 50 }
+22 -1
src/applications/differential/view/DifferentialReviewersView.php
··· 25 25 26 26 public function render() { 27 27 $viewer = $this->getUser(); 28 + $reviewers = $this->reviewers; 28 29 29 30 $view = new PHUIStatusListView(); 30 - foreach ($this->reviewers as $reviewer) { 31 + 32 + // Move resigned reviewers to the bottom. 33 + $head = array(); 34 + $tail = array(); 35 + foreach ($reviewers as $key => $reviewer) { 36 + if ($reviewer->isResigned()) { 37 + $tail[$key] = $reviewer; 38 + } else { 39 + $head[$key] = $reviewer; 40 + } 41 + } 42 + 43 + $reviewers = $head + $tail; 44 + foreach ($reviewers as $reviewer) { 31 45 $phid = $reviewer->getReviewerPHID(); 32 46 $handle = $this->handles[$phid]; 33 47 ··· 96 110 PHUIStatusItemView::ICON_MINUS, 97 111 'red', 98 112 pht('Blocking Review')); 113 + break; 114 + 115 + case DifferentialReviewerStatus::STATUS_RESIGNED: 116 + $item->setIcon( 117 + 'fa-times', 118 + 'grey', 119 + pht('Resigned')); 99 120 break; 100 121 101 122 default:
+4 -10
src/applications/differential/xaction/DifferentialRevisionReviewTransaction.php
··· 178 178 $reviewer->setLastActionDiffPHID($diff_phid); 179 179 } 180 180 181 - if ($status == DifferentialReviewerStatus::STATUS_RESIGNED) { 182 - if ($reviewer->getID()) { 183 - $reviewer->delete(); 184 - } 185 - } else { 186 - try { 187 - $reviewer->save(); 188 - } catch (AphrontDuplicateKeyQueryException $ex) { 189 - // At least for now, just ignore it if we lost a race. 190 - } 181 + try { 182 + $reviewer->save(); 183 + } catch (AphrontDuplicateKeyQueryException $ex) { 184 + // At least for now, just ignore it if we lost a race. 191 185 } 192 186 } 193 187 }