1
0
Fork 0
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:
vrana 2012-03-05 10:51:47 -08:00
parent 846cea715f
commit f5f7987013
4 changed files with 30 additions and 9 deletions

View 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
);

View file

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

View file

@ -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;
}
}

View file

@ -26,6 +26,7 @@ class DifferentialRevision extends DifferentialDAO {
protected $phid;
protected $authorPHID;
protected $lastReviewerPHID;
protected $dateCommitted;