Page MenuHomePhabricator

D8477.diff
No OneTemporary

D8477.diff

diff --git a/resources/celerity/map.php b/resources/celerity/map.php
--- a/resources/celerity/map.php
+++ b/resources/celerity/map.php
@@ -11,7 +11,7 @@
'core.pkg.js' => 'b7bdab05',
'darkconsole.pkg.js' => 'ca8671ce',
'differential.pkg.css' => 'd1b3a605',
- 'differential.pkg.js' => 'e0d3b0da',
+ 'differential.pkg.js' => '11a5b750',
'diffusion.pkg.css' => '3783278d',
'diffusion.pkg.js' => '5b4010f4',
'javelin.pkg.js' => '5b0f988e',
@@ -357,7 +357,6 @@
'rsrc/js/application/conpherence/behavior-widget-pane.js' => 'd8ef8659',
'rsrc/js/application/countdown/timer.js' => '889c96f3',
'rsrc/js/application/differential/DifferentialInlineCommentEditor.js' => 'f2441746',
- 'rsrc/js/application/differential/behavior-accept-with-errors.js' => 'e12c760a',
'rsrc/js/application/differential/behavior-add-reviewers-and-ccs.js' => '533a187b',
'rsrc/js/application/differential/behavior-comment-jump.js' => '71755c79',
'rsrc/js/application/differential/behavior-comment-preview.js' => '127f2018',
@@ -546,7 +545,6 @@
'javelin-behavior-countdown-timer' => '889c96f3',
'javelin-behavior-dark-console' => 'e9fdb5e5',
'javelin-behavior-device' => '03d6ed07',
- 'javelin-behavior-differential-accept-with-errors' => 'e12c760a',
'javelin-behavior-differential-add-reviewers-and-ccs' => '533a187b',
'javelin-behavior-differential-comment-jump' => '71755c79',
'javelin-behavior-differential-diff-radios' => 'e1ff79b1',
@@ -1817,11 +1815,6 @@
1 => 'javelin-util',
2 => 'javelin-request',
),
- 'e12c760a' =>
- array(
- 0 => 'javelin-behavior',
- 1 => 'javelin-dom',
- ),
'e1ff79b1' =>
array(
0 => 'javelin-behavior',
@@ -2140,18 +2133,17 @@
4 => 'javelin-behavior-differential-populate',
5 => 'javelin-behavior-differential-show-more',
6 => 'javelin-behavior-differential-diff-radios',
- 7 => 'javelin-behavior-differential-accept-with-errors',
- 8 => 'javelin-behavior-differential-comment-jump',
- 9 => 'javelin-behavior-differential-add-reviewers-and-ccs',
- 10 => 'javelin-behavior-differential-keyboard-navigation',
- 11 => 'javelin-behavior-aphront-drag-and-drop-textarea',
- 12 => 'javelin-behavior-phabricator-object-selector',
- 13 => 'javelin-behavior-repository-crossreference',
- 14 => 'javelin-behavior-load-blame',
- 15 => 'differential-inline-comment-editor',
- 16 => 'javelin-behavior-differential-dropdown-menus',
- 17 => 'javelin-behavior-differential-toggle-files',
- 18 => 'javelin-behavior-differential-user-select',
+ 7 => 'javelin-behavior-differential-comment-jump',
+ 8 => 'javelin-behavior-differential-add-reviewers-and-ccs',
+ 9 => 'javelin-behavior-differential-keyboard-navigation',
+ 10 => 'javelin-behavior-aphront-drag-and-drop-textarea',
+ 11 => 'javelin-behavior-phabricator-object-selector',
+ 12 => 'javelin-behavior-repository-crossreference',
+ 13 => 'javelin-behavior-load-blame',
+ 14 => 'differential-inline-comment-editor',
+ 15 => 'javelin-behavior-differential-dropdown-menus',
+ 16 => 'javelin-behavior-differential-toggle-files',
+ 17 => 'javelin-behavior-differential-user-select',
),
'diffusion.pkg.css' =>
array(
diff --git a/resources/sql/autopatches/20140212.dx.1.armageddon.php b/resources/sql/autopatches/20140212.dx.1.armageddon.php
--- a/resources/sql/autopatches/20140212.dx.1.armageddon.php
+++ b/resources/sql/autopatches/20140212.dx.1.armageddon.php
@@ -42,10 +42,10 @@
$metadata = array();
}
- $key_cc = DifferentialComment::METADATA_ADDED_CCS;
- $key_add_rev = DifferentialComment::METADATA_ADDED_REVIEWERS;
- $key_rem_rev = DifferentialComment::METADATA_REMOVED_REVIEWERS;
- $key_diff_id = DifferentialComment::METADATA_DIFF_ID;
+ $key_cc = 'added-ccs';
+ $key_add_rev = 'added-reviewers';
+ $key_rem_rev = 'removed-reviewers';
+ $key_diff_id = 'diff-id';
$xactions = array();
diff --git a/src/__phutil_library_map__.php b/src/__phutil_library_map__.php
--- a/src/__phutil_library_map__.php
+++ b/src/__phutil_library_map__.php
@@ -343,7 +343,6 @@
'DifferentialChangesetTwoUpRenderer' => 'applications/differential/render/DifferentialChangesetTwoUpRenderer.php',
'DifferentialChangesetTwoUpTestRenderer' => 'applications/differential/render/DifferentialChangesetTwoUpTestRenderer.php',
'DifferentialChangesetViewController' => 'applications/differential/controller/DifferentialChangesetViewController.php',
- 'DifferentialComment' => 'applications/differential/storage/DifferentialComment.php',
'DifferentialCommentPreviewController' => 'applications/differential/controller/DifferentialCommentPreviewController.php',
'DifferentialCommentSaveController' => 'applications/differential/controller/DifferentialCommentSaveController.php',
'DifferentialCommitMessageParser' => 'applications/differential/parser/DifferentialCommitMessageParser.php',
@@ -2864,7 +2863,6 @@
'DifferentialChangesetTwoUpRenderer' => 'DifferentialChangesetHTMLRenderer',
'DifferentialChangesetTwoUpTestRenderer' => 'DifferentialChangesetTestRenderer',
'DifferentialChangesetViewController' => 'DifferentialController',
- 'DifferentialComment' => 'PhabricatorMarkupInterface',
'DifferentialCommentPreviewController' => 'DifferentialController',
'DifferentialCommentSaveController' => 'DifferentialController',
'DifferentialCommitMessageParserTestCase' => 'PhabricatorTestCase',
diff --git a/src/applications/differential/storage/DifferentialComment.php b/src/applications/differential/storage/DifferentialComment.php
deleted file mode 100644
--- a/src/applications/differential/storage/DifferentialComment.php
+++ /dev/null
@@ -1,359 +0,0 @@
-<?php
-
-/**
- * Temporary proxy shell around ApplicationTransactions.
- */
-final class DifferentialComment
- implements PhabricatorMarkupInterface {
-
- const METADATA_ADDED_REVIEWERS = 'added-reviewers';
- const METADATA_REMOVED_REVIEWERS = 'removed-reviewers';
- const METADATA_ADDED_CCS = 'added-ccs';
- const METADATA_DIFF_ID = 'diff-id';
-
- const MARKUP_FIELD_BODY = 'markup:body';
-
- private $arbitraryDiffForFacebook;
- private $proxyComment;
- private $proxy;
-
- public function __construct() {
- $this->proxy = new DifferentialTransaction();
- }
-
- public function __clone() {
- $this->proxy = clone $this->proxy;
- if ($this->proxyComment) {
- $this->proxyComment = clone $this->proxyComment;
- }
- }
-
- public static function newFromModernTransaction(
- DifferentialTransaction $xaction) {
-
- $obj = new DifferentialComment();
- $obj->proxy = $xaction;
-
- if ($xaction->hasComment()) {
- $obj->proxyComment = $xaction->getComment();
- }
-
- return $obj;
- }
-
- public function getPHID() {
- return $this->proxy->getPHID();
- }
-
- public function getContent() {
- return $this->getProxyComment()->getContent();
- }
-
- public function setContent($content) {
- $this->getProxyComment()->setContent($content);
- return $this;
- }
-
- public function getAuthorPHID() {
- return $this->proxy->getAuthorPHID();
- }
-
- public function setAuthorPHID($author_phid) {
- $this->proxy->setAuthorPHID($author_phid);
- return $this;
- }
-
- public function setContentSource($content_source) {
- $this->proxy->setContentSource($content_source);
- $this->proxyComment->setContentSource($content_source);
- return $this;
- }
-
- public function setAction($action) {
- $meta = array();
- switch ($action) {
- case DifferentialAction::ACTION_COMMENT:
- $type = PhabricatorTransactions::TYPE_COMMENT;
- $old = null;
- $new = null;
- break;
- case DifferentialAction::ACTION_ADDREVIEWERS:
- $type = PhabricatorTransactions::TYPE_EDGE;
- $old = array();
- $new = array();
- $meta = array(
- 'edge:type' => PhabricatorEdgeConfig::TYPE_DREV_HAS_REVIEWER,
- );
- break;
- case DifferentialAction::ACTION_ADDCCS:
- $type = PhabricatorTransactions::TYPE_SUBSCRIBERS;
- $old = array();
- $new = array();
- break;
- case DifferentialAction::ACTION_UPDATE:
- $type = DifferentialTransaction::TYPE_UPDATE;
- $old = null;
- $new = null;
- break;
- case DifferentialTransaction::TYPE_INLINE:
- $type = $action;
- $old = null;
- $new = null;
- break;
- default:
- $type = DifferentialTransaction::TYPE_ACTION;
- $old = null;
- $new = $action;
- break;
- }
-
- $xaction = $this->proxy;
-
- $xaction
- ->setTransactionType($type)
- ->setOldValue($old)
- ->setNewValue($new);
-
- if ($meta) {
- foreach ($meta as $key => $value) {
- $xaction->setMetadataValue($key, $value);
- }
- }
-
- return $this;
- }
-
- public function getAction() {
- switch ($this->proxy->getTransactionType()) {
- case PhabricatorTransactions::TYPE_SUBSCRIBERS:
- return DifferentialAction::ACTION_ADDCCS;
- case DifferentialTransaction::TYPE_UPDATE:
- return DifferentialAction::ACTION_UPDATE;
- case PhabricatorTransactions::TYPE_EDGE:
- return DifferentialAction::ACTION_ADDREVIEWERS;
- case PhabricatorTransactions::TYPE_COMMENT:
- return DifferentialAction::ACTION_COMMENT;
- case DifferentialTransaction::TYPE_INLINE:
- return DifferentialTransaction::TYPE_INLINE;
- default:
- return $this->proxy->getNewValue();
- }
- }
-
- public function setMetadata(array $metadata) {
- if (!$this->proxy->getTransactionType()) {
- throw new Exception(pht('Call setAction() before setMetadata()!'));
- }
-
- $key_cc = self::METADATA_ADDED_CCS;
- $key_add_rev = self::METADATA_ADDED_REVIEWERS;
- $key_rem_rev = self::METADATA_REMOVED_REVIEWERS;
- $key_diff_id = self::METADATA_DIFF_ID;
-
- switch ($this->proxy->getTransactionType()) {
- case DifferentialTransaction::TYPE_UPDATE:
- $id = idx($metadata, $key_diff_id);
- $this->proxy->setNewValue($id);
- break;
- case PhabricatorTransactions::TYPE_EDGE:
- $rem = idx($metadata, $key_rem_rev, array());
- $old = array();
- foreach ($rem as $phid) {
- $old[$phid] = array(
- 'src' => $this->proxy->getObjectPHID(),
- 'type' => PhabricatorEdgeConfig::TYPE_DREV_HAS_REVIEWER,
- 'dst' => $phid,
- );
- }
- $this->proxy->setOldValue($old);
-
- $add = idx($metadata, $key_add_rev, array());
- $new = array();
- foreach ($add as $phid) {
- $new[$phid] = array(
- 'src' => $this->proxy->getObjectPHID(),
- 'type' => PhabricatorEdgeConfig::TYPE_DREV_HAS_REVIEWER,
- 'dst' => $phid,
- );
- }
- $this->proxy->setNewValue($new);
- break;
- case PhabricatorTransactions::TYPE_SUBSCRIBERS:
- $phids = idx($metadata, $key_cc, array());
- $new = array();
- foreach ($phids as $phid) {
- $new[$phid] = $phid;
- }
- $this->proxy->setNewValue($new);
- break;
- default:
- break;
- }
-
- return $this;
- }
-
- public function getMetadata() {
- if (!$this->proxy->getTransactionType()) {
- throw new Exception(pht('Call setAction() before getMetadata()!'));
- }
-
- $key_cc = self::METADATA_ADDED_CCS;
- $key_add_rev = self::METADATA_ADDED_REVIEWERS;
- $key_rem_rev = self::METADATA_REMOVED_REVIEWERS;
- $key_diff_id = self::METADATA_DIFF_ID;
-
- $type = $this->proxy->getTransactionType();
-
- switch ($type) {
- case PhabricatorTransactions::TYPE_SUBSCRIBERS:
- $value = $this->proxy->getNewValue();
- if (!$value) {
- $value = array();
- }
- return array(
- $key_cc => $value,
- );
- case DifferentialTransaction::TYPE_UPDATE:
- return array(
- $key_diff_id => $this->proxy->getNewValue(),
- );
- case PhabricatorTransactions::TYPE_EDGE:
- case PhabricatorTransactions::TYPE_SUBSCRIBERS:
- $old = $this->proxy->getOldValue();
- if (!$old) {
- $old = array();
- }
- $new = $this->proxy->getNewValue();
- if (!$new) {
- $new = array();
- }
-
- $rem = array_diff_key($old, $new);
- $add = array_diff_key($new, $old);
-
- if ($type == PhabricatorTransactions::TYPE_EDGE) {
- return array(
- $key_add_rev => array_keys($add),
- $key_rem_rev => array_keys($rem),
- );
- } else {
- return array(
- $key_cc => array_keys($add),
- );
- }
- default:
- return array();
- }
- }
-
- public function getContentSource() {
- return $this->proxy->getContentSource();
- }
-
- private function getProxyComment() {
- if (!$this->proxyComment) {
- $this->proxyComment = new DifferentialTransactionComment();
- }
- return $this->proxyComment;
- }
-
- public function setProxyComment(DifferentialTransactionComment $proxy) {
- $this->proxyComment = $proxy;
- $this->proxy->attachComment($proxy);
- return $this;
- }
-
- public function setRevision(DifferentialRevision $revision) {
- $this->getProxyComment()->setRevisionPHID($revision->getPHID());
- $this->proxy->setObjectPHID($revision->getPHID());
- return $this;
- }
-
- public function giveFacebookSomeArbitraryDiff(DifferentialDiff $diff) {
- $this->arbitraryDiffForFacebook = $diff;
- return $this;
- }
-
- public function getRequiredHandlePHIDs() {
- switch ($this->proxy->getTransactionType()) {
- case PhabricatorTransactions::TYPE_SUBSCRIBERS:
- case PhabricatorTransactions::TYPE_EDGE:
- return array_merge(
- array_keys($this->proxy->getOldValue()),
- array_keys($this->proxy->getNewValue()));
- }
-
- return array();
- }
-
- public function getMarkupFieldKey($field) {
- return 'DC:'.$this->getPHID();
- }
-
- public function newMarkupEngine($field) {
- return PhabricatorMarkupEngine::newDifferentialMarkupEngine(
- array(
- 'differential.diff' => $this->arbitraryDiffForFacebook,
- ));
- }
-
- public function getMarkupText($field) {
- return $this->getContent();
- }
-
- public function didMarkupText($field, $output, PhutilMarkupEngine $engine) {
- return $output;
- }
-
- public function shouldUseMarkupCache($field) {
- return (bool)$this->getPHID();
- }
-
- public function getDateCreated() {
- return $this->proxy->getDateCreated();
- }
-
- public function getRevisionPHID() {
- return $this->proxy->getObjectPHID();
- }
-
- public function save() {
- $this->proxy->openTransaction();
- $this->proxy
- ->setViewPolicy('public')
- ->setEditPolicy($this->getAuthorPHID())
- ->save();
-
- if ($this->getContent() !== null ||
- $this->getProxyComment()->getChangesetID()) {
-
- $this->getProxyComment()
- ->setAuthorPHID($this->getAuthorPHID())
- ->setViewPolicy('public')
- ->setEditPolicy($this->getAuthorPHID())
- ->setCommentVersion(1)
- ->setTransactionPHID($this->proxy->getPHID())
- ->save();
-
- $this->proxy
- ->setCommentVersion(1)
- ->setCommentPHID($this->getProxyComment()->getPHID())
- ->save();
- }
-
- $this->proxy->saveTransaction();
-
- return $this;
- }
-
- public function delete() {
- $this->proxy->delete();
- return $this;
- }
-
- public function getProxyTransaction() {
- return $this->proxy;
- }
-
-}

File Metadata

Mime Type
text/plain
Expires
Fri, Dec 20, 2:44 AM (21 h, 48 m)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
6909269
Default Alt Text
D8477.diff (15 KB)

Event Timeline