1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-12-20 12:30:56 +01:00

Separate revision updates into two separate comments

Summary:
Ref T2222. Instead of writing one comment which performs both a diff update and adds a comment, write two comments, one for each action. These will translate directly into ApplicationTransactions writes.

This has a small impact on the UX: these updates now render in two rows, instead of one. After T2222, they'll automerge back together.

{F111909}

Test Plan: Updated a revision.

Reviewers: btrahan

Reviewed By: btrahan

CC: aran

Maniphest Tasks: T2222

Differential Revision: https://secure.phabricator.com/D8200
This commit is contained in:
epriestley 2014-02-11 15:21:14 -08:00
parent 8e232a8bf1
commit c65fad3fca
2 changed files with 35 additions and 24 deletions

View file

@ -786,21 +786,29 @@ final class DifferentialRevisionEditor extends PhabricatorEditor {
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() {

View file

@ -127,6 +127,7 @@ final class DifferentialComment extends DifferentialDAO
$this->openTransaction();
$result = parent::save();
if (strlen($this->getContent())) {
$content_source = PhabricatorContentSource::newForSource(
PhabricatorContentSource::SOURCE_LEGACY,
array());
@ -145,6 +146,8 @@ final class DifferentialComment extends DifferentialDAO
->setLegacyCommentID($this->getID())
->setTransactionPHID($xaction_phid)
->save();
}
$this->saveTransaction();
return $result;