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

Treat "request review" more like an update

Summary:
After "reject; plan changes; request review", revisions go back to "needs revision". Instead, they should remain in "needs review" (the reviewers need to review comments on the "request review", in the normal case). Generally, "request reivew" should act a lot like "update", just not actually change the diff.

To accomplish this, downgrade reviewers on "request review" to "rejected older", just like we would on an update.

Test Plan: Did "reject; plan; request", revision ended in "needs review". Rejected it into "needs revision"; updated it into "needs review".

Reviewers: btrahan

Reviewed By: btrahan

Subscribers: dctrwatson, epriestley

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

+58 -32
+58 -32
src/applications/differential/editor/DifferentialTransactionEditor.php
··· 225 225 PhabricatorLiskDAO $object, 226 226 PhabricatorApplicationTransaction $xaction) { 227 227 228 + $results = parent::expandTransaction($object, $xaction); 229 + 228 230 $actor = $this->getActor(); 229 231 $actor_phid = $actor->getPHID(); 230 232 $type_edge = PhabricatorTransactions::TYPE_EDGE; ··· 232 234 $edge_reviewer = PhabricatorEdgeConfig::TYPE_DREV_HAS_REVIEWER; 233 235 $edge_ref_task = PhabricatorEdgeConfig::TYPE_DREV_HAS_RELATED_TASK; 234 236 235 - $results = parent::expandTransaction($object, $xaction); 237 + $downgrade_rejects = false; 238 + if ($this->getIsCloseByCommit()) { 239 + // Never downgrade reviewers when we're closing a revision after a 240 + // commit. 241 + } else { 242 + switch ($xaction->getTransactionType()) { 243 + case DifferentialTransaction::TYPE_UPDATE: 244 + $downgrade_rejects = true; 245 + break; 246 + case DifferentialTransaction::TYPE_ACTION: 247 + switch ($xaction->getNewValue()) { 248 + case DifferentialAction::ACTION_REQUEST: 249 + $downgrade_rejects = true; 250 + break; 251 + } 252 + break; 253 + } 254 + } 255 + 256 + $new_accept = DifferentialReviewerStatus::STATUS_ACCEPTED; 257 + $new_reject = DifferentialReviewerStatus::STATUS_REJECTED; 258 + $old_accept = DifferentialReviewerStatus::STATUS_ACCEPTED_OLDER; 259 + $old_reject = DifferentialReviewerStatus::STATUS_REJECTED_OLDER; 260 + 261 + if ($downgrade_rejects) { 262 + // When a revision is updated, change all "reject" to "rejected older 263 + // revision". This means we won't immediately push the update back into 264 + // "needs review", but outstanding rejects will still block it from 265 + // moving to "accepted". 266 + 267 + // We also do this for "Request Review", even though the diff is not 268 + // updated directly. Essentially, this acts like an update which doesn't 269 + // actually change the diff text. 270 + 271 + $edits = array(); 272 + foreach ($object->getReviewerStatus() as $reviewer) { 273 + if ($reviewer->getStatus() == $new_reject) { 274 + $edits[$reviewer->getReviewerPHID()] = array( 275 + 'data' => array( 276 + 'status' => $old_reject, 277 + ), 278 + ); 279 + } 280 + 281 + // TODO: If sticky accept is off, do a similar update for accepts. 282 + } 283 + 284 + if ($edits) { 285 + $results[] = id(new DifferentialTransaction()) 286 + ->setTransactionType($type_edge) 287 + ->setMetadataValue('edge:type', $edge_reviewer) 288 + ->setIgnoreOnNoEffect(true) 289 + ->setNewValue(array('+' => $edits)); 290 + } 291 + } 292 + 236 293 switch ($xaction->getTransactionType()) { 237 294 case DifferentialTransaction::TYPE_UPDATE: 238 295 if ($this->getIsCloseByCommit()) { 239 296 // Don't bother with any of this if this update is a side effect of 240 297 // commit detection. 241 298 break; 242 - } 243 - 244 - $new_accept = DifferentialReviewerStatus::STATUS_ACCEPTED; 245 - $new_reject = DifferentialReviewerStatus::STATUS_REJECTED; 246 - $old_accept = DifferentialReviewerStatus::STATUS_ACCEPTED_OLDER; 247 - $old_reject = DifferentialReviewerStatus::STATUS_REJECTED_OLDER; 248 - 249 - // When a revision is updated, change all "reject" to "rejected older 250 - // revision". This means we won't immediately push the update back into 251 - // "needs review", but outstanding rejects will still block it from 252 - // moving to "accepted". 253 - $edits = array(); 254 - foreach ($object->getReviewerStatus() as $reviewer) { 255 - if ($reviewer->getStatus() == $new_reject) { 256 - $edits[$reviewer->getReviewerPHID()] = array( 257 - 'data' => array( 258 - 'status' => $old_reject, 259 - ), 260 - ); 261 - } 262 - 263 - // TODO: If sticky accept is off, do a similar update for accepts. 264 - } 265 - 266 - if ($edits) { 267 - $results[] = id(new DifferentialTransaction()) 268 - ->setTransactionType($type_edge) 269 - ->setMetadataValue('edge:type', $edge_reviewer) 270 - ->setIgnoreOnNoEffect(true) 271 - ->setNewValue(array('+' => $edits)); 272 299 } 273 300 274 301 // When a revision is updated and the diff comes from a branch named ··· 528 555 } 529 556 530 557 $object->attachReviewerStatus($new_revision->getReviewerStatus()); 531 - 532 558 533 559 foreach ($xactions as $xaction) { 534 560 switch ($xaction->getTransactionType()) {