mirror of
https://we.phorge.it/source/phorge.git
synced 2025-01-18 02:31:10 +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.');
|
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
|
// 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
|
// 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
|
// by "updated". Notably, this allows "ping" comments to push it to the
|
||||||
|
|
|
@ -19,7 +19,6 @@
|
||||||
final class DifferentialReviewersFieldSpecification
|
final class DifferentialReviewersFieldSpecification
|
||||||
extends DifferentialFieldSpecification {
|
extends DifferentialFieldSpecification {
|
||||||
|
|
||||||
private $primaryReviewers = array();
|
|
||||||
private $reviewers;
|
private $reviewers;
|
||||||
private $error;
|
private $error;
|
||||||
|
|
||||||
|
@ -150,8 +149,8 @@ final class DifferentialReviewersFieldSpecification
|
||||||
}
|
}
|
||||||
|
|
||||||
public function renderValueForRevisionList(DifferentialRevision $revision) {
|
public function renderValueForRevisionList(DifferentialRevision $revision) {
|
||||||
if (isset($this->primaryReviewers[$revision->getID()])) {
|
$primary_reviewer = $this->getPrimaryReviewer($revision);
|
||||||
$primary_reviewer = $this->primaryReviewers[$revision->getID()];
|
if ($primary_reviewer) {
|
||||||
$other_reviewers = array_flip($revision->getReviewers());
|
$other_reviewers = array_flip($revision->getReviewers());
|
||||||
unset($other_reviewers[$primary_reviewer]);
|
unset($other_reviewers[$primary_reviewer]);
|
||||||
if ($other_reviewers) {
|
if ($other_reviewers) {
|
||||||
|
@ -167,16 +166,19 @@ final class DifferentialReviewersFieldSpecification
|
||||||
|
|
||||||
public function getRequiredHandlePHIDsForRevisionList(
|
public function getRequiredHandlePHIDsForRevisionList(
|
||||||
DifferentialRevision $revision) {
|
DifferentialRevision $revision) {
|
||||||
$primary_reviewer = $revision->loadReviewedBy();
|
$primary_reviewer = $this->getPrimaryReviewer($revision);
|
||||||
if (!$primary_reviewer) {
|
|
||||||
$reviewer_phids = $revision->getReviewers();
|
|
||||||
$primary_reviewer = reset($reviewer_phids);
|
|
||||||
}
|
|
||||||
if ($primary_reviewer) {
|
if ($primary_reviewer) {
|
||||||
$this->primaryReviewers[$revision->getID()] = $primary_reviewer;
|
|
||||||
return array($primary_reviewer);
|
return array($primary_reviewer);
|
||||||
}
|
}
|
||||||
return array();
|
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 $phid;
|
||||||
protected $authorPHID;
|
protected $authorPHID;
|
||||||
|
protected $lastReviewerPHID;
|
||||||
|
|
||||||
protected $dateCommitted;
|
protected $dateCommitted;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue