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

Allow accepting accepted revisions, and rejecting rejected revisions

Summary:
Ref T1279. With the new per-reviewer status, you can always accept or reject a revision.

This is primarily cosmetic/UI changes. In particular, you've always been able to reject a rejected revision, the UI just didn't show you an option.

Test Plan: Accepted accepted revisions; rejected rejected revisions. See screenshots.

Reviewers: btrahan

Reviewed By: btrahan

CC: aran

Maniphest Tasks: T1279

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

+38 -28
+19 -3
src/applications/differential/controller/DifferentialRevisionViewController.php
··· 588 588 $viewer_phid = $viewer->getPHID(); 589 589 $viewer_is_owner = ($viewer_phid == $revision->getAuthorPHID()); 590 590 $viewer_is_reviewer = in_array($viewer_phid, $revision->getReviewers()); 591 - $viewer_did_accept = ($viewer_phid === $revision->loadReviewedBy()); 592 591 $status = $revision->getStatus(); 592 + 593 + $viewer_has_accepted = false; 594 + $viewer_has_rejected = false; 595 + $status_accepted = DifferentialReviewerStatus::STATUS_ACCEPTED; 596 + $status_rejected = DifferentialReviewerStatus::STATUS_REJECTED; 597 + foreach ($revision->getReviewerStatus() as $reviewer) { 598 + if ($reviewer->getReviewerPHID() == $viewer_phid) { 599 + if ($reviewer->getStatus() == $status_accepted) { 600 + $viewer_has_accepted = true; 601 + } 602 + if ($reviewer->getStatus() == $status_rejected) { 603 + $viewer_has_rejected = true; 604 + } 605 + break; 606 + } 607 + } 593 608 594 609 $allow_self_accept = PhabricatorEnv::getEnvConfig( 595 610 'differential.allow-self-accept'); ··· 631 646 break; 632 647 case ArcanistDifferentialRevisionStatus::NEEDS_REVISION: 633 648 $actions[DifferentialAction::ACTION_ACCEPT] = true; 649 + $actions[DifferentialAction::ACTION_REJECT] = !$viewer_has_rejected; 634 650 $actions[DifferentialAction::ACTION_RESIGN] = $viewer_is_reviewer; 635 651 break; 636 652 case ArcanistDifferentialRevisionStatus::ACCEPTED: 653 + $actions[DifferentialAction::ACTION_ACCEPT] = !$viewer_has_accepted; 637 654 $actions[DifferentialAction::ACTION_REJECT] = true; 638 - $actions[DifferentialAction::ACTION_RESIGN] = 639 - $viewer_is_reviewer && !$viewer_did_accept; 655 + $actions[DifferentialAction::ACTION_RESIGN] = $viewer_is_reviewer; 640 656 break; 641 657 case ArcanistDifferentialRevisionStatus::CLOSED: 642 658 case ArcanistDifferentialRevisionStatus::ABANDONED:
+19 -25
src/applications/differential/editor/DifferentialCommentEditor.php
··· 210 210 throw new Exception('You can not accept your own revision.'); 211 211 } 212 212 213 - if (($revision_status != 214 - ArcanistDifferentialRevisionStatus::NEEDS_REVIEW) && 215 - ($revision_status != 216 - ArcanistDifferentialRevisionStatus::NEEDS_REVISION)) { 217 - 218 - switch ($revision_status) { 219 - case ArcanistDifferentialRevisionStatus::ACCEPTED: 220 - throw new DifferentialActionHasNoEffectException( 221 - "You can not accept this revision because someone else ". 222 - "already accepted it."); 223 - case ArcanistDifferentialRevisionStatus::ABANDONED: 224 - throw new DifferentialActionHasNoEffectException( 225 - "You can not accept this revision because it has been ". 226 - "abandoned."); 227 - case ArcanistDifferentialRevisionStatus::CLOSED: 228 - throw new DifferentialActionHasNoEffectException( 229 - "You can not accept this revision because it has already ". 230 - "been closed."); 231 - default: 232 - throw new Exception( 233 - "Unexpected revision state '{$revision_status}'!"); 234 - } 213 + switch ($revision_status) { 214 + case ArcanistDifferentialRevisionStatus::ABANDONED: 215 + throw new DifferentialActionHasNoEffectException( 216 + "You can not accept this revision because it has been ". 217 + "abandoned."); 218 + case ArcanistDifferentialRevisionStatus::CLOSED: 219 + throw new DifferentialActionHasNoEffectException( 220 + "You can not accept this revision because it has already ". 221 + "been closed."); 222 + case ArcanistDifferentialRevisionStatus::NEEDS_REVIEW: 223 + case ArcanistDifferentialRevisionStatus::NEEDS_REVISION: 224 + case ArcanistDifferentialRevisionStatus::ACCEPTED: 225 + // We expect "Accept" from these states. 226 + break; 227 + default: 228 + throw new Exception( 229 + "Unexpected revision state '{$revision_status}'!"); 235 230 } 236 231 237 232 $revision ··· 306 301 case ArcanistDifferentialRevisionStatus::ACCEPTED: 307 302 case ArcanistDifferentialRevisionStatus::NEEDS_REVISION: 308 303 case ArcanistDifferentialRevisionStatus::NEEDS_REVIEW: 309 - // NOTE: We allow you to reject an already-rejected revision 310 - // because it doesn't create any ambiguity and avoids a rather 311 - // needless dialog. 304 + // We expect rejects from these states. 312 305 break; 313 306 case ArcanistDifferentialRevisionStatus::ABANDONED: 314 307 throw new DifferentialActionHasNoEffectException( ··· 343 336 case ArcanistDifferentialRevisionStatus::ACCEPTED: 344 337 case ArcanistDifferentialRevisionStatus::NEEDS_REVISION: 345 338 case ArcanistDifferentialRevisionStatus::NEEDS_REVIEW: 339 + // We expect accepts from these states. 346 340 break; 347 341 case ArcanistDifferentialRevisionStatus::ABANDONED: 348 342 throw new DifferentialActionHasNoEffectException(