mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-27 01:02:42 +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:
parent
56c8387403
commit
07f72cf463
2 changed files with 9 additions and 2 deletions
|
@ -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)
|
||||
|
|
|
@ -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".',
|
||||
|
|
Loading…
Reference in a new issue