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

Add a "Draft" state for revisions, and action bucket support

Summary:
Ref T2543. There's no way to put revisions into this state yet, but start adding support for when there is.

Adds the status constant, plus support for bucketing them.

Test Plan:
- Manually put a revision in "Draft" state by updating the database directly.
- Verified my drafts showed up in a "Drafts" section on the bucket view.
- Verified others' drafts did not appear on the action bucket view.
- Viewed revisions, queried for "Draft" revisions, etc (stuff we get for free).

{F5186781}

{F5186782}

{F5186783}

Reviewers: amckinley

Reviewed By: amckinley

Maniphest Tasks: T2543

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

+59
+15
src/applications/differential/constants/DifferentialRevisionStatus.php
··· 8 8 const ACCEPTED = 'accepted'; 9 9 const PUBLISHED = 'published'; 10 10 const ABANDONED = 'abandoned'; 11 + const DRAFT = 'draft'; 11 12 12 13 private $key; 13 14 private $spec = array(); ··· 74 75 75 76 public function isChangePlanned() { 76 77 return ($this->key === self::CHANGES_PLANNED); 78 + } 79 + 80 + public function isDraft() { 81 + return ($this->key === self::DRAFT); 77 82 } 78 83 79 84 public static function newForStatus($status) { ··· 161 166 'closed' => true, 162 167 'color.icon' => 'black', 163 168 'color.tag' => 'indigo', 169 + 'color.ansi' => null, 170 + ), 171 + self::DRAFT => array( 172 + 'name' => pht('Draft'), 173 + // For legacy clients, treat this as though it is "Needs Review". 174 + 'legacy' => 0, 175 + 'icon' => 'fa-file-text-o', 176 + 'closed' => false, 177 + 'color.icon' => 'grey', 178 + 'color.tag' => 'grey', 164 179 'color.ansi' => null, 165 180 ), 166 181 );
+40
src/applications/differential/query/DifferentialRevisionRequiredActionResultBucket.php
··· 37 37 // other project or package reviewers which they have authority over. 38 38 $this->filterResigned($phids); 39 39 40 + // We also throw away draft revisions which you aren't the author of. 41 + $this->filterOtherDrafts($phids); 42 + 40 43 $groups = array(); 41 44 42 45 $groups[] = $this->newGroup() ··· 60 63 ->setName(pht('Ready to Update')) 61 64 ->setNoDataString(pht('No revisions are waiting for updates.')) 62 65 ->setObjects($this->filterShouldUpdate($phids)); 66 + 67 + $groups[] = $this->newGroup() 68 + ->setName(pht('Drafts')) 69 + ->setNoDataString(pht('You have no draft revisions.')) 70 + ->setObjects($this->filterDrafts($phids)); 63 71 64 72 $groups[] = $this->newGroup() 65 73 ->setName(pht('Waiting on Review')) ··· 237 245 $results = array(); 238 246 foreach ($objects as $key => $object) { 239 247 if (!$this->hasReviewersWithStatus($object, $phids, $resigned)) { 248 + continue; 249 + } 250 + 251 + $results[$key] = $object; 252 + unset($this->objects[$key]); 253 + } 254 + 255 + return $results; 256 + } 257 + 258 + private function filterOtherDrafts(array $phids) { 259 + $objects = $this->getRevisionsNotAuthored($this->objects, $phids); 260 + 261 + $results = array(); 262 + foreach ($objects as $key => $object) { 263 + if (!$object->isDraft()) { 264 + continue; 265 + } 266 + 267 + $results[$key] = $object; 268 + unset($this->objects[$key]); 269 + } 270 + 271 + return $results; 272 + } 273 + 274 + private function filterDrafts(array $phids) { 275 + $objects = $this->getRevisionsAuthored($this->objects, $phids); 276 + 277 + $results = array(); 278 + foreach ($objects as $key => $object) { 279 + if (!$object->isDraft()) { 240 280 continue; 241 281 } 242 282
+4
src/applications/differential/storage/DifferentialRevision.php
··· 653 653 return $this->getStatusObject()->isPublished(); 654 654 } 655 655 656 + public function isDraft() { 657 + return $this->getStatusObject()->isDraft(); 658 + } 659 + 656 660 public function getStatusIcon() { 657 661 return $this->getStatusObject()->getIcon(); 658 662 }