Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F15399612
D17514.id42139.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
4 KB
Referenced Files
None
Subscribers
None
D17514.id42139.diff
View Options
diff --git a/resources/sql/autopatches/20170320.reviewers.01.lastaction.sql b/resources/sql/autopatches/20170320.reviewers.01.lastaction.sql
new file mode 100644
--- /dev/null
+++ b/resources/sql/autopatches/20170320.reviewers.01.lastaction.sql
@@ -0,0 +1,2 @@
+ALTER TABLE {$NAMESPACE}_differential.differential_reviewer
+ ADD lastActionDiffPHID VARBINARY(64);
diff --git a/resources/sql/autopatches/20170320.reviewers.02.lastcomment.sql b/resources/sql/autopatches/20170320.reviewers.02.lastcomment.sql
new file mode 100644
--- /dev/null
+++ b/resources/sql/autopatches/20170320.reviewers.02.lastcomment.sql
@@ -0,0 +1,2 @@
+ALTER TABLE {$NAMESPACE}_differential.differential_reviewer
+ ADD lastCommentDiffPHID VARBINARY(64);
diff --git a/src/applications/differential/editor/DifferentialTransactionEditor.php b/src/applications/differential/editor/DifferentialTransactionEditor.php
--- a/src/applications/differential/editor/DifferentialTransactionEditor.php
+++ b/src/applications/differential/editor/DifferentialTransactionEditor.php
@@ -718,6 +718,9 @@
break;
}
+
+ $this->markReviewerComments($object, $xactions);
+
return $xactions;
}
@@ -1836,4 +1839,59 @@
->setNewValue($edits);
}
+ public function getActiveDiff($object) {
+ if ($this->getIsNewObject()) {
+ return null;
+ } else {
+ return $object->getActiveDiff();
+ }
+ }
+
+ /**
+ * When a reviewer makes a comment, mark the last revision they commented
+ * on.
+ *
+ * This allows us to show a hint to help authors and other reviewers quickly
+ * distinguish between reviewers who have participated in the discussion and
+ * reviewers who haven't been part of it.
+ */
+ private function markReviewerComments($object, array $xactions) {
+ $acting_phid = $this->getActingAsPHID();
+ if (!$acting_phid) {
+ return;
+ }
+
+ $diff = $this->getActiveDiff($object);
+ if (!$diff) {
+ return;
+ }
+
+ $has_comment = false;
+ foreach ($xactions as $xaction) {
+ if ($xaction->hasComment()) {
+ $has_comment = true;
+ break;
+ }
+ }
+
+ if (!$has_comment) {
+ return;
+ }
+
+ $reviewer_table = new DifferentialReviewer();
+ $conn = $reviewer_table->establishConnection('w');
+
+ queryfx(
+ $conn,
+ 'UPDATE %T SET lastCommentDiffPHID = %s
+ WHERE revisionPHID = %s
+ AND reviewerPHID = %s',
+ $reviewer_table->getTableName(),
+ $diff->getPHID(),
+ $object->getPHID(),
+ $acting_phid);
+ }
+
+
+
}
diff --git a/src/applications/differential/storage/DifferentialReviewer.php b/src/applications/differential/storage/DifferentialReviewer.php
--- a/src/applications/differential/storage/DifferentialReviewer.php
+++ b/src/applications/differential/storage/DifferentialReviewer.php
@@ -7,10 +7,15 @@
protected $reviewerPHID;
protected $reviewerStatus;
+ protected $lastActionDiffPHID;
+ protected $lastCommentDiffPHID;
+
protected function getConfiguration() {
return array(
self::CONFIG_COLUMN_SCHEMA => array(
'reviewerStatus' => 'text64',
+ 'lastActionDiffPHID' => 'phid?',
+ 'lastCommentDiffPHID' => 'phid?',
),
self::CONFIG_KEY_SCHEMA => array(
'key_revision' => array(
diff --git a/src/applications/differential/xaction/DifferentialRevisionReviewTransaction.php b/src/applications/differential/xaction/DifferentialRevisionReviewTransaction.php
--- a/src/applications/differential/xaction/DifferentialRevisionReviewTransaction.php
+++ b/src/applications/differential/xaction/DifferentialRevisionReviewTransaction.php
@@ -138,6 +138,13 @@
// Now, do the new write.
if ($map) {
+ $diff = $this->getEditor()->getActiveDiff($revision);
+ if ($diff) {
+ $diff_phid = $diff->getPHID();
+ } else {
+ $diff_phid = null;
+ }
+
$table = new DifferentialReviewer();
$reviewers = $table->loadAllWhere(
@@ -156,6 +163,10 @@
$reviewer->setReviewerStatus($status);
+ if ($diff_phid) {
+ $reviewer->setLastActionDiffPHID($diff_phid);
+ }
+
if ($status == DifferentialReviewerStatus::STATUS_RESIGNED) {
if ($reviewer->getID()) {
$reviewer->delete();
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Tue, Mar 18, 5:48 AM (2 d, 10 h ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
7475850
Default Alt Text
D17514.id42139.diff (4 KB)
Attached To
Mode
D17514: Store "last comment" and "last action" diffs on reviewers
Attached
Detach File
Event Timeline
Log In to Comment