1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-12-23 14:00:56 +01:00

Don't publish "empty" inline comments

Summary:
Ref T13513. Currently, if you start an inline and then submit overall comments, we publish an empty inline. This is literally faithful to what you did, but almost certainly not the intent.

Instead, simply ignore empty inlines at publishing time (and ignore "done" state changes for those comments).

We could delete them outright, but if we do, they'll break if you have another window open with the empty inline (since the stored comment won't exist anymore). At least for now, leave them in place.

Test Plan: Created empty inlines, submitted comments, no longer saw them publish.

Maniphest Tasks: T13513

Differential Revision: https://secure.phabricator.com/D21211
This commit is contained in:
epriestley 2020-05-04 09:22:20 -07:00
parent 67da18e374
commit f5ef341c9e
3 changed files with 21 additions and 1 deletions

View file

@ -81,4 +81,8 @@ final class PhabricatorAuditTransactionComment
return $this;
}
public function isEmptyInlineComment() {
return !strlen($this->getContent());
}
}

View file

@ -127,4 +127,8 @@ final class DifferentialTransactionComment
return $this;
}
public function isEmptyInlineComment() {
return !strlen($this->getContent());
}
}

View file

@ -5033,7 +5033,12 @@ abstract class PhabricatorApplicationTransactionEditor
$xactions = array();
foreach ($inlines as $inline) {
foreach ($inlines as $key => $inline) {
if ($inline->isEmptyInlineComment()) {
unset($inlines[$key]);
continue;
}
$xactions[] = $object->getApplicationTransactionTemplate()
->setTransactionType($transaction_type)
->attachComment($inline);
@ -5079,6 +5084,13 @@ abstract class PhabricatorApplicationTransactionEditor
$inlines = array_mergev($inlines);
foreach ($inlines as $key => $inline) {
if ($inline->isEmptyInlineComment()) {
unset($inlines[$key]);
continue;
}
}
if (!$inlines) {
return null;
}