Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F14019562
D8200.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
3 KB
Referenced Files
None
Subscribers
None
D8200.diff
View Options
Index: src/applications/differential/editor/DifferentialRevisionEditor.php
===================================================================
--- src/applications/differential/editor/DifferentialRevisionEditor.php
+++ src/applications/differential/editor/DifferentialRevisionEditor.php
@@ -786,21 +786,29 @@
private function createComment() {
- $comment = id(new DifferentialComment())
+ $template = id(new DifferentialComment())
->setAuthorPHID($this->getActorPHID())
- ->setRevision($this->revision)
- ->setContent($this->getComments())
+ ->setRevision($this->revision);
+ if ($this->contentSource) {
+ $template->setContentSource($this->contentSource);
+ }
+
+ // Write the "update active diff" transaction.
+ id(clone $template)
->setAction(DifferentialAction::ACTION_UPDATE)
->setMetadata(
array(
DifferentialComment::METADATA_DIFF_ID => $this->getDiff()->getID(),
- ));
+ ))
+ ->save();
- if ($this->contentSource) {
- $comment->setContentSource($this->contentSource);
+ // If we have a comment, write the "add a comment" transaction.
+ if (strlen($this->getComments())) {
+ id(clone $template)
+ ->setAction(DifferentialAction::ACTION_COMMENT)
+ ->setContent($this->getComments())
+ ->save();
}
-
- $comment->save();
}
private function updateAuxiliaryFields() {
Index: src/applications/differential/storage/DifferentialComment.php
===================================================================
--- src/applications/differential/storage/DifferentialComment.php
+++ src/applications/differential/storage/DifferentialComment.php
@@ -127,24 +127,27 @@
$this->openTransaction();
$result = parent::save();
- $content_source = PhabricatorContentSource::newForSource(
- PhabricatorContentSource::SOURCE_LEGACY,
- array());
-
- $xaction_phid = PhabricatorPHID::generateNewPHID(
- PhabricatorApplicationTransactionPHIDTypeTransaction::TYPECONST,
- DifferentialPHIDTypeRevision::TYPECONST);
-
- $proxy = $this->getProxyComment();
- $proxy
- ->setAuthorPHID($this->getAuthorPHID())
- ->setViewPolicy('public')
- ->setEditPolicy($this->getAuthorPHID())
- ->setContentSource($content_source)
- ->setCommentVersion(1)
- ->setLegacyCommentID($this->getID())
- ->setTransactionPHID($xaction_phid)
- ->save();
+ if (strlen($this->getContent())) {
+ $content_source = PhabricatorContentSource::newForSource(
+ PhabricatorContentSource::SOURCE_LEGACY,
+ array());
+
+ $xaction_phid = PhabricatorPHID::generateNewPHID(
+ PhabricatorApplicationTransactionPHIDTypeTransaction::TYPECONST,
+ DifferentialPHIDTypeRevision::TYPECONST);
+
+ $proxy = $this->getProxyComment();
+ $proxy
+ ->setAuthorPHID($this->getAuthorPHID())
+ ->setViewPolicy('public')
+ ->setEditPolicy($this->getAuthorPHID())
+ ->setContentSource($content_source)
+ ->setCommentVersion(1)
+ ->setLegacyCommentID($this->getID())
+ ->setTransactionPHID($xaction_phid)
+ ->save();
+ }
+
$this->saveTransaction();
return $result;
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Wed, Nov 6, 10:46 PM (1 w, 6 d ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
6723349
Default Alt Text
D8200.diff (3 KB)
Attached To
Mode
D8200: Separate revision updates into two separate comments
Attached
Detach File
Event Timeline
Log In to Comment