From aa91dc992e248e6d470c0d0a546081422dd2641b Mon Sep 17 00:00:00 2001 From: epriestley Date: Wed, 22 Mar 2017 11:42:52 -0700 Subject: [PATCH] Record which user accepted on behalf of packages/owners reviewers Summary: Ref T12271. Don't do anything with this yet, but store who accepted/rejected/whatever on behalf of reviewers. In the future, we could use this to render stuff like "Blessed Committers (accepted by epriestley)" or whatever. I don't know that this is necessarily super useful, but it's easy to track, seems likely to be useful, and would be a gigantic pain to backfill later if we decide we want it. Test Plan: Accepted/rejected a revision, saw reviewers update appropriately. Reviewers: chad Reviewed By: chad Maniphest Tasks: T12271 Differential Revision: https://secure.phabricator.com/D17537 --- resources/sql/autopatches/20170322.reviewers.04.actor.sql | 2 ++ .../differential/storage/DifferentialReviewer.php | 2 ++ .../xaction/DifferentialRevisionReviewTransaction.php | 5 +++++ 3 files changed, 9 insertions(+) create mode 100644 resources/sql/autopatches/20170322.reviewers.04.actor.sql diff --git a/resources/sql/autopatches/20170322.reviewers.04.actor.sql b/resources/sql/autopatches/20170322.reviewers.04.actor.sql new file mode 100644 index 0000000000..27b46848a7 --- /dev/null +++ b/resources/sql/autopatches/20170322.reviewers.04.actor.sql @@ -0,0 +1,2 @@ +ALTER TABLE {$NAMESPACE}_differential.differential_reviewer + ADD lastActorPHID VARBINARY(64); diff --git a/src/applications/differential/storage/DifferentialReviewer.php b/src/applications/differential/storage/DifferentialReviewer.php index eec05398b6..d43f533b5c 100644 --- a/src/applications/differential/storage/DifferentialReviewer.php +++ b/src/applications/differential/storage/DifferentialReviewer.php @@ -8,6 +8,7 @@ final class DifferentialReviewer protected $reviewerStatus; protected $lastActionDiffPHID; protected $lastCommentDiffPHID; + protected $lastActorPHID; private $authority = array(); @@ -17,6 +18,7 @@ final class DifferentialReviewer 'reviewerStatus' => 'text64', 'lastActionDiffPHID' => 'phid?', 'lastCommentDiffPHID' => 'phid?', + 'lastActorPHID' => 'phid?', ), self::CONFIG_KEY_SCHEMA => array( 'key_revision' => array( diff --git a/src/applications/differential/xaction/DifferentialRevisionReviewTransaction.php b/src/applications/differential/xaction/DifferentialRevisionReviewTransaction.php index a0fe0ea3d0..86aba03e25 100644 --- a/src/applications/differential/xaction/DifferentialRevisionReviewTransaction.php +++ b/src/applications/differential/xaction/DifferentialRevisionReviewTransaction.php @@ -198,12 +198,17 @@ abstract class DifferentialRevisionReviewTransaction ->setReviewerPHID($dst_phid); } + $old_status = $reviewer->getReviewerStatus(); $reviewer->setReviewerStatus($status); if ($diff_phid) { $reviewer->setLastActionDiffPHID($diff_phid); } + if ($old_status !== $status) { + $reviewer->setLastActorPHID($this->getActingAsPHID()); + } + try { $reviewer->save(); } catch (AphrontDuplicateKeyQueryException $ex) {