1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-27 09:12:41 +01:00

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
This commit is contained in:
Bob Trahan 2013-02-07 11:17:20 -08:00
parent 56c8387403
commit 07f72cf463
2 changed files with 9 additions and 2 deletions

View file

@ -64,6 +64,7 @@ final class ConpherenceUpdateController extends
$top = $request->getInt('image_y'); $top = $request->getInt('image_y');
$left = $request->getInt('image_x'); $left = $request->getInt('image_x');
$file_id = $request->getInt('file_id'); $file_id = $request->getInt('file_id');
$title = $request->getStr('title');
if ($file_id) { if ($file_id) {
$orig_file = id(new PhabricatorFileQuery()) $orig_file = id(new PhabricatorFileQuery())
->setViewer($user) ->setViewer($user)
@ -101,6 +102,8 @@ final class ConpherenceUpdateController extends
pht('This server only supports these image formats: %s.', pht('This server only supports these image formats: %s.',
implode(', ', $supported_formats)); implode(', ', $supported_formats));
} }
// use the existing title in this image upload case
$title = $conpherence->getTitle();
} else if ($top !== null || $left !== null) { } else if ($top !== null || $left !== null) {
$file = $conpherence->getImage(ConpherenceImageData::SIZE_ORIG); $file = $conpherence->getImage(ConpherenceImageData::SIZE_ORIG);
$xformer = new PhabricatorImageTransformer(); $xformer = new PhabricatorImageTransformer();
@ -119,7 +122,6 @@ final class ConpherenceUpdateController extends
) )
->setNewValue($image_phid); ->setNewValue($image_phid);
} }
$title = $request->getStr('title');
if ($title != $conpherence->getTitle()) { if ($title != $conpherence->getTitle()) {
$xactions[] = id(new ConpherenceTransaction()) $xactions[] = id(new ConpherenceTransaction())
->setTransactionType(ConpherenceTransactionType::TYPE_TITLE) ->setTransactionType(ConpherenceTransactionType::TYPE_TITLE)

View file

@ -46,12 +46,17 @@ final class ConpherenceTransaction extends PhabricatorApplicationTransaction {
switch ($this->getTransactionType()) { switch ($this->getTransactionType()) {
case ConpherenceTransactionType::TYPE_TITLE: case ConpherenceTransactionType::TYPE_TITLE:
if ($old) { if ($old && $new) {
$title = pht( $title = pht(
'%s renamed this conpherence from "%s" to "%s".', '%s renamed this conpherence from "%s" to "%s".',
$this->renderHandleLink($author_phid), $this->renderHandleLink($author_phid),
phutil_escape_html($old), phutil_escape_html($old),
phutil_escape_html($new)); phutil_escape_html($new));
} else if ($old) {
$title = pht(
'%s deleted the conpherence name "%s".',
$this->renderHandleLink($author_phid),
phutil_escape_html($old));
} else { } else {
$title = pht( $title = pht(
'%s named this conpherence "%s".', '%s named this conpherence "%s".',