1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-09-20 09:18:48 +02:00

Fix rendering of comments deleted by editing

Summary:
Fixes T4609. Steps are:

  - Make a comment.
  - Edit it.
  - Delete all the text.

We expect to see "This comment has been deleted." -- instead, things currently render goofy.

Root cause is that `hasComment()` means both "comment object exists" //and// "comment object is nonempty".

Test Plan: {F128862}

Reviewers: btrahan

Reviewed By: btrahan

Subscribers: aran, epriestley

Maniphest Tasks: T4609

Differential Revision: https://secure.phabricator.com/D8533
This commit is contained in:
epriestley 2014-03-14 11:53:30 -07:00
parent 838f781285
commit 48910537b9

View file

@ -200,14 +200,18 @@ class PhabricatorApplicationTransactionView extends AphrontView {
$engine = $this->getOrBuildEngine();
$comment = $xaction->getComment();
if ($xaction->hasComment()) {
if ($comment) {
if ($comment->getIsDeleted()) {
return phutil_tag(
'em',
array(),
pht('This comment has been deleted.'));
} else {
} else if ($xaction->hasComment()) {
return $engine->getOutput($comment, $field);
} else {
// This is an empty, non-deleted comment. Usually this happens when
// rendering previews.
return null;
}
}