@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.) hq.recaptime.dev/wiki/Phorge
phorge phabricator
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Fix an issue where inline comments with only edit suggestions are considered empty

Summary:
Ref T13513. An inline is not considered empty if it has a suggestion, but some of the shared transaction code doesn't test for this properly.

Update the shared transaction code to be aware that application comments may have more complex emptiness rules.

Test Plan:
- Posted an inline with only an edit suggestion, comment went through.
- Tried to post a normal empty comment, got an appropriate warning.

Maniphest Tasks: T13513

Differential Revision: https://secure.phabricator.com/D21287

+27 -6
+12
src/applications/differential/storage/DifferentialTransactionComment.php
··· 144 144 return $this; 145 145 } 146 146 147 + 148 + public function isEmptyComment() { 149 + if (!parent::isEmptyComment()) { 150 + return false; 151 + } 152 + 153 + return $this->newInlineCommentObject() 154 + ->getContentState() 155 + ->isEmptyContentState(); 156 + } 157 + 158 + 147 159 }
+3 -6
src/applications/transactions/storage/PhabricatorApplicationTransaction.php
··· 127 127 } 128 128 129 129 public function hasComment() { 130 - if (!$this->getComment()) { 130 + $comment = $this->getComment(); 131 + if (!$comment) { 131 132 return false; 132 133 } 133 134 134 - $content = $this->getComment()->getContent(); 135 - 136 - // If the content is empty or consists of only whitespace, don't count 137 - // this as comment. 138 - if (!strlen(trim($content))) { 135 + if ($comment->isEmptyComment()) { 139 136 return false; 140 137 } 141 138
+12
src/applications/transactions/storage/PhabricatorApplicationTransactionComment.php
··· 107 107 $this->getTransactionPHID()); 108 108 } 109 109 110 + public function isEmptyComment() { 111 + $content = $this->getContent(); 112 + 113 + // The comment is empty if there's no content, or if the content only has 114 + // whitespace. 115 + if (!strlen(trim($content))) { 116 + return true; 117 + } 118 + 119 + return false; 120 + } 121 + 110 122 /* -( PhabricatorMarkupInterface )----------------------------------------- */ 111 123 112 124