Page MenuHomePhabricator

D21207.diff
No OneTemporary

D21207.diff

diff --git a/src/applications/differential/xaction/DifferentialRevisionReviewersTransaction.php b/src/applications/differential/xaction/DifferentialRevisionReviewersTransaction.php
--- a/src/applications/differential/xaction/DifferentialRevisionReviewersTransaction.php
+++ b/src/applications/differential/xaction/DifferentialRevisionReviewersTransaction.php
@@ -385,4 +385,64 @@
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,
+ );
+ }
}

File Metadata

Mime Type
text/plain
Expires
Thu, May 9, 9:01 PM (3 w, 1 d ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
6277440
Default Alt Text
D21207.diff (2 KB)

Event Timeline