From 1f00f2728be896dca7203d0af7e2dfb97ca1b653 Mon Sep 17 00:00:00 2001 From: Lauri-Henrik Jalonen Date: Mon, 25 Feb 2013 06:19:03 -0800 Subject: [PATCH] Pholio inline comments appear after comment Summary: Pholio inline comments now appear after comments. Adding inline comment shows up properly on comments. Test Plan: {F33723} Reviewers: epriestley, johann.fridriksson Reviewed By: johann.fridriksson CC: aran, Korvin Maniphest Tasks: T2446 Differential Revision: https://secure.phabricator.com/D5103 --- .../controller/PholioMockCommentController.php | 6 +++--- .../pholio/editor/PholioMockEditor.php | 18 ++++++++++++++++++ .../pholio/storage/PholioTransaction.php | 5 +++++ 3 files changed, 26 insertions(+), 3 deletions(-) diff --git a/src/applications/pholio/controller/PholioMockCommentController.php b/src/applications/pholio/controller/PholioMockCommentController.php index 5e5b413688..e711a05877 100644 --- a/src/applications/pholio/controller/PholioMockCommentController.php +++ b/src/applications/pholio/controller/PholioMockCommentController.php @@ -56,9 +56,9 @@ final class PholioMockCommentController extends PholioController { mpull($mock->getImages(), 'getID')); foreach ($inlineComments as $inlineComment) { - $xactions[] = id(new PholioTransaction()) - ->setTransactionType(PholioTransactionType::TYPE_INLINE) - ->attachComment($inlineComment); + $xactions[] = id(new PholioTransaction()) + ->setTransactionType(PholioTransactionType::TYPE_INLINE) + ->attachComment($inlineComment); } $editor = id(new PholioMockEditor()) diff --git a/src/applications/pholio/editor/PholioMockEditor.php b/src/applications/pholio/editor/PholioMockEditor.php index 51502bb593..71a82a05bb 100644 --- a/src/applications/pholio/editor/PholioMockEditor.php +++ b/src/applications/pholio/editor/PholioMockEditor.php @@ -140,4 +140,22 @@ final class PholioMockEditor extends PhabricatorApplicationTransactionEditor { return true; } + protected function sortTransactions(array $xactions) { + $head = array(); + $tail = array(); + + // Move inline comments to the end, so the comments preceed them. + foreach ($xactions as $xaction) { + $type = $xaction->getTransactionType(); + if ($type == PholioTransactionType::TYPE_INLINE) { + $tail[] = $xaction; + } else { + $head[] = $xaction; + } + } + + return array_values(array_merge($head, $tail)); + } + + } diff --git a/src/applications/pholio/storage/PholioTransaction.php b/src/applications/pholio/storage/PholioTransaction.php index ece88cbdd5..f61390b12f 100644 --- a/src/applications/pholio/storage/PholioTransaction.php +++ b/src/applications/pholio/storage/PholioTransaction.php @@ -53,6 +53,11 @@ final class PholioTransaction extends PhabricatorApplicationTransaction { 'The old description was: %s', $this->renderHandleLink($author_phid), $old); + break; + case PholioTransactionType::TYPE_INLINE: + return pht( + '%s added an inline comment.', + $this->renderHandleLink($author_phid)); } return parent::getTitle();