mirror of
https://we.phorge.it/source/phorge.git
synced 2025-01-22 20:51:10 +01:00
Provide detailed information about reviewer changes in "transaction.search"
Summary: See PHI1722, which requests transaction details about reviewer changes. This adds them; they're structured to be similar to "projects" and "subscribers" transactions and the "reviewers" attachment on revisions. Test Plan: {F7410675} Differential Revision: https://secure.phabricator.com/D21207
This commit is contained in:
parent
b89e6c0fa9
commit
b2cfcda114
1 changed files with 60 additions and 0 deletions
|
@ -385,4 +385,64 @@ final class DifferentialRevisionReviewersTransaction
|
|||
return $errors;
|
||||
}
|
||||
|
||||
|
||||
public function getTransactionTypeForConduit($xaction) {
|
||||
return 'reviewers';
|
||||
}
|
||||
|
||||
public function getFieldValuesForConduit($xaction, $data) {
|
||||
$old_value = $xaction->getOldValue();
|
||||
$new_value = $xaction->getNewValue();
|
||||
|
||||
$status_blocking = DifferentialReviewerStatus::STATUS_BLOCKING;
|
||||
|
||||
$add_phids = array_diff_key($new_value, $old_value);
|
||||
foreach ($add_phids as $add_phid => $value) {
|
||||
$add_phids[$add_phid] = array(
|
||||
'operation' => 'add',
|
||||
'phid' => $add_phid,
|
||||
'oldStatus' => null,
|
||||
'newStatus' => $value,
|
||||
'isBlocking' => ($value === $status_blocking),
|
||||
);
|
||||
}
|
||||
|
||||
$rem_phids = array_diff_key($old_value, $new_value);
|
||||
foreach ($rem_phids as $rem_phid => $value) {
|
||||
$rem_phids[$rem_phid] = array(
|
||||
'operation' => 'remove',
|
||||
'phid' => $rem_phid,
|
||||
'oldStatus' => $value,
|
||||
'newStatus' => null,
|
||||
'isBlocking' => false,
|
||||
);
|
||||
}
|
||||
|
||||
$mod_phids = array_intersect_key($old_value, $new_value);
|
||||
foreach ($mod_phids as $mod_phid => $ignored) {
|
||||
$old = $old_value[$mod_phid];
|
||||
$new = $new_value[$mod_phid];
|
||||
|
||||
if ($old === $new) {
|
||||
unset($mod_phids[$mod_phid]);
|
||||
continue;
|
||||
}
|
||||
|
||||
$mod_phids[$mod_phid] = array(
|
||||
'operation' => 'update',
|
||||
'phid' => $mod_phid,
|
||||
'oldStatus' => $old,
|
||||
'newStatus' => $new,
|
||||
'isBlocking' => ($new === $status_blocking),
|
||||
);
|
||||
}
|
||||
|
||||
$all_ops = $add_phids + $rem_phids + $mod_phids;
|
||||
$all_ops = array_select_keys($all_ops, $new_value) + $all_ops;
|
||||
$all_ops = array_values($all_ops);
|
||||
|
||||
return array(
|
||||
'operations' => $all_ops,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue