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

When a user accepts a revision, accept for all projects the user has authority over

Summary: Ref T1279. If you accept a revision, also accept on behalf of all the projects you have authority to accept for.

Test Plan:
- Accepted a revision which I was a reviewer on, saw my own status and an authority project's status change to "Accepted".
- Accepted a revision which I was not a reviewer on, saw my own status be added (as "Accepted") and the project's status update.

Also, see screenshot.

Reviewers: btrahan

Reviewed By: btrahan

CC: aran, wisutsak.jaisue.7

Maniphest Tasks: T1279

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

+27 -9
+27 -9
src/applications/differential/editor/DifferentialCommentEditor.php
··· 102 102 ->withIDs(array($this->revision->getID())) 103 103 ->needRelationships(true) 104 104 ->needReviewerStatus(true) 105 + ->needReviewerAuthority(true) 105 106 ->executeOne(); 106 107 107 108 $revision = $this->revision; ··· 150 151 if ($reviewer->getStatus() == $status_added) { 151 152 DifferentialRevisionEditor::updateReviewerStatus( 152 153 $revision, 153 - $this->getActor(), 154 + $actor, 154 155 $actor_phid, 155 156 DifferentialReviewerStatus::STATUS_COMMENTED); 156 157 } ··· 208 209 if ($actor_is_author && !$allow_self_accept) { 209 210 throw new Exception('You can not accept your own revision.'); 210 211 } 212 + 211 213 if (($revision_status != 212 214 ArcanistDifferentialRevisionStatus::NEEDS_REVIEW) && 213 215 ($revision_status != ··· 235 237 $revision 236 238 ->setStatus(ArcanistDifferentialRevisionStatus::ACCEPTED); 237 239 238 - DifferentialRevisionEditor::updateReviewerStatus( 239 - $revision, 240 - $this->getActor(), 241 - $actor_phid, 242 - DifferentialReviewerStatus::STATUS_ACCEPTED); 240 + $was_reviewer_already = false; 241 + foreach ($revision->getReviewerStatus() as $reviewer) { 242 + if ($reviewer->hasAuthority($actor)) { 243 + DifferentialRevisionEditor::updateReviewerStatus( 244 + $revision, 245 + $actor, 246 + $reviewer->getReviewerPHID(), 247 + DifferentialReviewerStatus::STATUS_ACCEPTED); 248 + if ($reviewer->getReviewerPHID() == $actor_phid) { 249 + $was_reviewer_already = true; 250 + } 251 + } 252 + } 253 + 254 + if (!$was_reviewer_already) { 255 + DifferentialRevisionEditor::updateReviewerStatus( 256 + $revision, 257 + $actor, 258 + $actor_phid, 259 + DifferentialReviewerStatus::STATUS_ACCEPTED); 260 + } 243 261 break; 244 262 245 263 case DifferentialAction::ACTION_REQUEST: ··· 307 325 308 326 DifferentialRevisionEditor::updateReviewerStatus( 309 327 $revision, 310 - $this->getActor(), 328 + $actor, 311 329 $actor_phid, 312 330 DifferentialReviewerStatus::STATUS_REJECTED); 313 331 ··· 604 622 605 623 $phids = array($actor_phid); 606 624 $handles = id(new PhabricatorHandleQuery()) 607 - ->setViewer($this->getActor()) 625 + ->setViewer($actor) 608 626 ->withPHIDs($phids) 609 627 ->execute(); 610 628 $actor_handle = $handles[$actor_phid]; ··· 620 638 $comment, 621 639 $changesets, 622 640 $inline_comments)) 623 - ->setActor($this->getActor()) 641 + ->setActor($actor) 624 642 ->setExcludeMailRecipientPHIDs($this->getExcludeMailRecipientPHIDs()) 625 643 ->setToPHIDs( 626 644 array_merge(