mirror of
https://we.phorge.it/source/phorge.git
synced 2025-01-17 18:21:11 +01:00
Revert rP87c60abbd02d, apply D1772
Test Plan: Apply SQL patch. Visit /differential/. Reviewers: epriestley Reviewed By: epriestley CC: aran, epriestley Differential Revision: https://secure.phabricator.com/D1781
This commit is contained in:
parent
846cea715f
commit
f5f7987013
4 changed files with 30 additions and 9 deletions
12
resources/sql/patches/113.lastreviewer.sql
Normal file
12
resources/sql/patches/113.lastreviewer.sql
Normal file
|
@ -0,0 +1,12 @@
|
|||
ALTER TABLE `phabricator_differential`.`differential_revision`
|
||||
ADD `lastReviewerPHID` varchar(64) BINARY AFTER `authorPHID`;
|
||||
|
||||
UPDATE `phabricator_differential`.`differential_revision`
|
||||
SET `lastReviewerPHID` = (
|
||||
SELECT `authorPHID`
|
||||
FROM `differential_comment`
|
||||
WHERE `revisionID` = `differential_revision`.`id`
|
||||
AND `action` IN ('accept', 'reject')
|
||||
ORDER BY `id` DESC
|
||||
LIMIT 1
|
||||
);
|
|
@ -386,6 +386,12 @@ class DifferentialCommentEditor {
|
|||
throw new Exception('Unsupported action.');
|
||||
}
|
||||
|
||||
// Update information about reviewer in charge.
|
||||
if ($action == DifferentialAction::ACTION_ACCEPT ||
|
||||
$action == DifferentialAction::ACTION_REJECT) {
|
||||
$revision->setLastReviewerPHID($actor_phid);
|
||||
}
|
||||
|
||||
// Always save the revision (even if we didn't actually change any of its
|
||||
// properties) so that it jumps to the top of the revision list when sorted
|
||||
// by "updated". Notably, this allows "ping" comments to push it to the
|
||||
|
|
|
@ -19,7 +19,6 @@
|
|||
final class DifferentialReviewersFieldSpecification
|
||||
extends DifferentialFieldSpecification {
|
||||
|
||||
private $primaryReviewers = array();
|
||||
private $reviewers;
|
||||
private $error;
|
||||
|
||||
|
@ -150,8 +149,8 @@ final class DifferentialReviewersFieldSpecification
|
|||
}
|
||||
|
||||
public function renderValueForRevisionList(DifferentialRevision $revision) {
|
||||
if (isset($this->primaryReviewers[$revision->getID()])) {
|
||||
$primary_reviewer = $this->primaryReviewers[$revision->getID()];
|
||||
$primary_reviewer = $this->getPrimaryReviewer($revision);
|
||||
if ($primary_reviewer) {
|
||||
$other_reviewers = array_flip($revision->getReviewers());
|
||||
unset($other_reviewers[$primary_reviewer]);
|
||||
if ($other_reviewers) {
|
||||
|
@ -167,16 +166,19 @@ final class DifferentialReviewersFieldSpecification
|
|||
|
||||
public function getRequiredHandlePHIDsForRevisionList(
|
||||
DifferentialRevision $revision) {
|
||||
$primary_reviewer = $revision->loadReviewedBy();
|
||||
if (!$primary_reviewer) {
|
||||
$reviewer_phids = $revision->getReviewers();
|
||||
$primary_reviewer = reset($reviewer_phids);
|
||||
}
|
||||
$primary_reviewer = $this->getPrimaryReviewer($revision);
|
||||
if ($primary_reviewer) {
|
||||
$this->primaryReviewers[$revision->getID()] = $primary_reviewer;
|
||||
return array($primary_reviewer);
|
||||
}
|
||||
return array();
|
||||
}
|
||||
|
||||
private function getPrimaryReviewer(DifferentialRevision $revision) {
|
||||
$primary_reviewer = $revision->getLastReviewerPHID();
|
||||
if (!$primary_reviewer) {
|
||||
$primary_reviewer = head($revision->getReviewers());
|
||||
}
|
||||
return $primary_reviewer;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -26,6 +26,7 @@ class DifferentialRevision extends DifferentialDAO {
|
|||
|
||||
protected $phid;
|
||||
protected $authorPHID;
|
||||
protected $lastReviewerPHID;
|
||||
|
||||
protected $dateCommitted;
|
||||
|
||||
|
|
Loading…
Reference in a new issue