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) {