From 71de5f2da2551a687657ca16cec83c42e95e05e2 Mon Sep 17 00:00:00 2001 From: epriestley Date: Sun, 1 Jan 2017 10:42:30 -0800 Subject: [PATCH] Add more strings for Paste title changes Summary: See downstream: Test Plan: {F2286968} Reviewers: chad Reviewed By: chad Differential Revision: https://secure.phabricator.com/D17126 --- .../PhabricatorPasteTitleTransaction.php | 54 +++++++++++++++---- 1 file changed, 43 insertions(+), 11 deletions(-) diff --git a/src/applications/paste/xaction/PhabricatorPasteTitleTransaction.php b/src/applications/paste/xaction/PhabricatorPasteTitleTransaction.php index f9d24a0a93..931a78df96 100644 --- a/src/applications/paste/xaction/PhabricatorPasteTitleTransaction.php +++ b/src/applications/paste/xaction/PhabricatorPasteTitleTransaction.php @@ -14,20 +14,52 @@ final class PhabricatorPasteTitleTransaction } public function getTitle() { - return pht( - '%s changed the title of this paste from %s to %s.', - $this->renderAuthor(), - $this->renderOldValue(), - $this->renderNewValue()); + $old = $this->getOldValue(); + $new = $this->getNeWValue(); + + if (strlen($old) && strlen($new)) { + return pht( + '%s changed the title of this paste from %s to %s.', + $this->renderAuthor(), + $this->renderOldValue(), + $this->renderNewValue()); + } else if (strlen($new)) { + return pht( + '%s changed the title of this paste from untitled to %s.', + $this->renderAuthor(), + $this->renderNewValue()); + } else { + return pht( + '%s changed the title of this paste from %s to untitled.', + $this->renderAuthor(), + $this->renderOldValue()); + } } public function getTitleForFeed() { - return pht( - '%s updated the title for %s from %s to %s.', - $this->renderAuthor(), - $this->renderObject(), - $this->renderOldValue(), - $this->renderNewValue()); + $old = $this->getOldValue(); + $new = $this->getNeWValue(); + + if (strlen($old) && strlen($new)) { + return pht( + '%s updated the title for %s from %s to %s.', + $this->renderAuthor(), + $this->renderObject(), + $this->renderOldValue(), + $this->renderNewValue()); + } else if (strlen($new)) { + return pht( + '%s updated the title for %s from untitled to %s.', + $this->renderAuthor(), + $this->renderObject(), + $this->renderNewValue()); + } else { + return pht( + '%s updated the title for %s from %s to untitled.', + $this->renderAuthor(), + $this->renderObject(), + $this->renderOldValue()); + } } }