@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.

Require valid comments to contain at least one non-whitespace character

Summary:
See downstream <https://phabricator.wikimedia.org/T88655>. This is very marginal, but we currently allow comments consisting of //only// whitespace.

These are probably always mistakes, so treat them like completely empty comments.

(We intentionally do not trim leading or trailing whitespace from comments when posting them becuase leading spaces can be used to trigger codeblock formatting.)

Test Plan:
- Posted empty, nonempty, and whitespace-only comments.
- Whitespace-only comments now have the same behavior as truly empty comments (e.g., do not actually generate a transaction).

Reviewers: amckinley

Reviewed By: amckinley

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

+13 -1
+13 -1
src/applications/transactions/storage/PhabricatorApplicationTransaction.php
··· 127 127 } 128 128 129 129 public function hasComment() { 130 - return $this->getComment() && strlen($this->getComment()->getContent()); 130 + if (!$this->getComment()) { 131 + return false; 132 + } 133 + 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))) { 139 + return false; 140 + } 141 + 142 + return true; 131 143 } 132 144 133 145 public function getComment() {