1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-12-19 12:00:55 +01: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(); $engine = $this->getOrBuildEngine();
$comment = $xaction->getComment(); $comment = $xaction->getComment();
if ($xaction->hasComment()) { if ($comment) {
if ($comment->getIsDeleted()) { if ($comment->getIsDeleted()) {
return phutil_tag( return phutil_tag(
'em', 'em',
array(), array(),
pht('This comment has been deleted.')); pht('This comment has been deleted.'));
} else { } else if ($xaction->hasComment()) {
return $engine->getOutput($comment, $field); return $engine->getOutput($comment, $field);
} else {
// This is an empty, non-deleted comment. Usually this happens when
// rendering previews.
return null;
} }
} }