From 07f72cf4635c919141e987fd2eeb945a87f5aa4e Mon Sep 17 00:00:00 2001 From: Bob Trahan Date: Thu, 7 Feb 2013 11:17:20 -0800 Subject: [PATCH] Fix conpherence name clearing bug Summary: pre-patch, when you upload a photo if the conphernece has a name it gets cleared. Post patch this no longer happens. Patch also makes the case where you delete the conpherence name have more sensical text. Test Plan: named a conpherence, uploaded an image, verified the name stayed the same. Deleted a conpherence name by changing the text to nothing and verified it work correctly, including having good transaction text. Reviewers: epriestley, chad Reviewed By: epriestley CC: aran, Korvin Maniphest Tasks: T2399 Differential Revision: https://secure.phabricator.com/D4852 --- .../conpherence/controller/ConpherenceUpdateController.php | 4 +++- .../conpherence/storage/ConpherenceTransaction.php | 7 ++++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/src/applications/conpherence/controller/ConpherenceUpdateController.php b/src/applications/conpherence/controller/ConpherenceUpdateController.php index ad3bf86fa1..b9b7131be3 100644 --- a/src/applications/conpherence/controller/ConpherenceUpdateController.php +++ b/src/applications/conpherence/controller/ConpherenceUpdateController.php @@ -64,6 +64,7 @@ final class ConpherenceUpdateController extends $top = $request->getInt('image_y'); $left = $request->getInt('image_x'); $file_id = $request->getInt('file_id'); + $title = $request->getStr('title'); if ($file_id) { $orig_file = id(new PhabricatorFileQuery()) ->setViewer($user) @@ -101,6 +102,8 @@ final class ConpherenceUpdateController extends pht('This server only supports these image formats: %s.', implode(', ', $supported_formats)); } + // use the existing title in this image upload case + $title = $conpherence->getTitle(); } else if ($top !== null || $left !== null) { $file = $conpherence->getImage(ConpherenceImageData::SIZE_ORIG); $xformer = new PhabricatorImageTransformer(); @@ -119,7 +122,6 @@ final class ConpherenceUpdateController extends ) ->setNewValue($image_phid); } - $title = $request->getStr('title'); if ($title != $conpherence->getTitle()) { $xactions[] = id(new ConpherenceTransaction()) ->setTransactionType(ConpherenceTransactionType::TYPE_TITLE) diff --git a/src/applications/conpherence/storage/ConpherenceTransaction.php b/src/applications/conpherence/storage/ConpherenceTransaction.php index 22a4aa666e..64afcf9157 100644 --- a/src/applications/conpherence/storage/ConpherenceTransaction.php +++ b/src/applications/conpherence/storage/ConpherenceTransaction.php @@ -46,12 +46,17 @@ final class ConpherenceTransaction extends PhabricatorApplicationTransaction { switch ($this->getTransactionType()) { case ConpherenceTransactionType::TYPE_TITLE: - if ($old) { + if ($old && $new) { $title = pht( '%s renamed this conpherence from "%s" to "%s".', $this->renderHandleLink($author_phid), phutil_escape_html($old), phutil_escape_html($new)); + } else if ($old) { + $title = pht( + '%s deleted the conpherence name "%s".', + $this->renderHandleLink($author_phid), + phutil_escape_html($old)); } else { $title = pht( '%s named this conpherence "%s".',