Page MenuHomePhabricator

D7375.diff
No OneTemporary

D7375.diff

Index: src/applications/differential/controller/DifferentialRevisionViewController.php
===================================================================
--- src/applications/differential/controller/DifferentialRevisionViewController.php
+++ src/applications/differential/controller/DifferentialRevisionViewController.php
@@ -91,9 +91,6 @@
$aux_fields = $this->loadAuxiliaryFields($revision);
$comments = $revision->loadComments();
- $comments = array_merge(
- $this->getImplicitComments($revision, reset($diffs)),
- $comments);
$all_changesets = $changesets;
$inlines = $this->loadInlineComments(
@@ -111,22 +108,8 @@
mpull($comments, 'getAuthorPHID'));
foreach ($comments as $comment) {
- $metadata = $comment->getMetadata();
- $added_reviewers = idx(
- $metadata,
- DifferentialComment::METADATA_ADDED_REVIEWERS);
- if ($added_reviewers) {
- foreach ($added_reviewers as $phid) {
- $object_phids[] = $phid;
- }
- }
- $added_ccs = idx(
- $metadata,
- DifferentialComment::METADATA_ADDED_CCS);
- if ($added_ccs) {
- foreach ($added_ccs as $phid) {
- $object_phids[] = $phid;
- }
+ foreach ($comment->getRequiredHandlePHIDs() as $phid) {
+ $object_phids[] = $phid;
}
}
@@ -479,38 +462,6 @@
));
}
- private function getImplicitComments(
- DifferentialRevision $revision,
- DifferentialDiff $diff) {
-
- $author_phid = nonempty(
- $diff->getAuthorPHID(),
- $revision->getAuthorPHID());
-
- $template = new DifferentialComment();
- $template->setAuthorPHID($author_phid);
- $template->setRevisionID($revision->getID());
- $template->setDateCreated($revision->getDateCreated());
-
- $comments = array();
-
- if (strlen($revision->getSummary())) {
- $summary_comment = clone $template;
- $summary_comment->setContent($revision->getSummary());
- $summary_comment->setAction(DifferentialAction::ACTION_SUMMARIZE);
- $comments[] = $summary_comment;
- }
-
- if (strlen($revision->getTestPlan())) {
- $testplan_comment = clone $template;
- $testplan_comment->setContent($revision->getTestPlan());
- $testplan_comment->setAction(DifferentialAction::ACTION_TESTPLAN);
- $comments[] = $testplan_comment;
- }
-
- return $comments;
- }
-
private function getRevisionActions(DifferentialRevision $revision) {
$user = $this->getRequest()->getUser();
$viewer_phid = $user->getPHID();
Index: src/applications/differential/editor/DifferentialCommentEditor.php
===================================================================
--- src/applications/differential/editor/DifferentialCommentEditor.php
+++ src/applications/differential/editor/DifferentialCommentEditor.php
@@ -566,7 +566,7 @@
$comment = id(new DifferentialComment())
->setAuthorPHID($actor_phid)
- ->setRevisionID($revision->getID())
+ ->setRevision($revision)
->setAction($action)
->setContent((string)$this->message)
->setMetadata($metadata);
Index: src/applications/differential/editor/DifferentialRevisionEditor.php
===================================================================
--- src/applications/differential/editor/DifferentialRevisionEditor.php
+++ src/applications/differential/editor/DifferentialRevisionEditor.php
@@ -783,10 +783,9 @@
private function createComment() {
- $revision_id = $this->revision->getID();
$comment = id(new DifferentialComment())
->setAuthorPHID($this->getActorPHID())
- ->setRevisionID($revision_id)
+ ->setRevision($this->revision)
->setContent($this->getComments())
->setAction(DifferentialAction::ACTION_UPDATE)
->setMetadata(
Index: src/applications/differential/storage/DifferentialComment.php
===================================================================
--- src/applications/differential/storage/DifferentialComment.php
+++ src/applications/differential/storage/DifferentialComment.php
@@ -20,11 +20,39 @@
private $arbitraryDiffForFacebook;
+ public function setRevision(DifferentialRevision $revision) {
+ return $this->setRevisionID($revision->getID());
+ }
+
public function giveFacebookSomeArbitraryDiff(DifferentialDiff $diff) {
$this->arbitraryDiffForFacebook = $diff;
return $this;
}
+ public function getRequiredHandlePHIDs() {
+ $phids = array();
+
+ $metadata = $this->getMetadata();
+ $added_reviewers = idx(
+ $metadata,
+ self::METADATA_ADDED_REVIEWERS);
+ if ($added_reviewers) {
+ foreach ($added_reviewers as $phid) {
+ $phids[] = $phid;
+ }
+ }
+ $added_ccs = idx(
+ $metadata,
+ self::METADATA_ADDED_CCS);
+ if ($added_ccs) {
+ foreach ($added_ccs as $phid) {
+ $phids[] = $phid;
+ }
+ }
+
+ return $phids;
+ }
+
public function getConfiguration() {
return array(
self::CONFIG_SERIALIZATION => array(
@@ -42,16 +70,8 @@
return PhabricatorContentSource::newFromSerialized($this->contentSource);
}
-
public function getMarkupFieldKey($field) {
- if ($this->getID()) {
- return 'DC:'.$this->getID();
- }
-
- // The summary and test plan render as comments, but do not have IDs.
- // They are also mutable. Build keys using content hashes.
- $hash = PhabricatorHash::digest($this->getMarkupText($field));
- return 'DC:'.$hash;
+ return 'DC:'.$this->getID();
}
public function newMarkupEngine($field) {
@@ -70,18 +90,7 @@
}
public function shouldUseMarkupCache($field) {
- if ($this->getID()) {
- return true;
- }
-
- $action = $this->getAction();
- switch ($action) {
- case DifferentialAction::ACTION_SUMMARIZE:
- case DifferentialAction::ACTION_TESTPLAN:
- return true;
- }
-
- return false;
+ return (bool)$this->getID();
}
}
Index: src/applications/differential/view/DifferentialRevisionDetailView.php
===================================================================
--- src/applications/differential/view/DifferentialRevisionDetailView.php
+++ src/applications/differential/view/DifferentialRevisionDetailView.php
@@ -112,6 +112,28 @@
$properties->setHasKeyboardShortcuts(true);
$properties->setActionList($actions);
+ $properties->invokeWillRenderEvent();
+
+ if (strlen($revision->getSummary())) {
+ $properties->addSectionHeader(pht('Summary'));
+ $properties->addTextContent(
+ PhabricatorMarkupEngine::renderOneObject(
+ id(new PhabricatorMarkupOneOff())->setContent(
+ $revision->getSummary()),
+ 'default',
+ $user));
+ }
+
+ if (strlen($revision->getTestPlan())) {
+ $properties->addSectionHeader(pht('Test Plan'));
+ $properties->addTextContent(
+ PhabricatorMarkupEngine::renderOneObject(
+ id(new PhabricatorMarkupOneOff())->setContent(
+ $revision->getTestPlan()),
+ 'default',
+ $user));
+ }
+
$object_box = id(new PHUIObjectBoxView())
->setHeader($header)
->addPropertyList($properties);

File Metadata

Mime Type
text/plain
Expires
Oct 19 2024, 10:51 AM (4 w, 4 d ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
6731750
Default Alt Text
D7375.diff (7 KB)

Event Timeline