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

When rendering changesets, discard empty draft inline comments

Summary: Ref T13513. When you load a changeset, discard all empty inlines. This is likely a more desirable behavior than keeping empty editors around, even though the rest of the pipeline generally handles them fairly well now.

Test Plan:
- Started an inline, didn't type any text or save, reloaded page.
- Before: page restores empty editor in the same place.
- After: we just discard this likely-pointless empty inline.

Maniphest Tasks: T13513

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

+23
+7
src/applications/audit/storage/PhabricatorAuditInlineComment.php
··· 111 111 $viewer->getPHID()); 112 112 } 113 113 114 + foreach ($inlines as $key => $inline) { 115 + $is_draft = !$inline->getTransactionPHID(); 116 + if ($is_draft && $inline->isEmptyInlineComment()) { 117 + unset($inlines[$key]); 118 + } 119 + } 120 + 114 121 return self::buildProxies($inlines); 115 122 } 116 123
+1
src/applications/differential/controller/DifferentialChangesetViewController.php
··· 197 197 $query = id(new DifferentialInlineCommentQuery()) 198 198 ->setViewer($viewer) 199 199 ->needHidden(true) 200 + ->withEmptyInlineComments(false) 200 201 ->withRevisionPHIDs(array($revision->getPHID())); 201 202 $inlines = $query->execute(); 202 203 $inlines = $query->adjustInlinesForChangesets(
+15
src/applications/differential/query/DifferentialInlineCommentQuery.php
··· 16 16 private $revisionPHIDs; 17 17 private $deletedDrafts; 18 18 private $needHidden; 19 + private $withEmpty; 19 20 20 21 public function setViewer(PhabricatorUser $viewer) { 21 22 $this->viewer = $viewer; ··· 61 62 return $this; 62 63 } 63 64 65 + public function withEmptyInlineComments($empty) { 66 + $this->withEmpty = $empty; 67 + return $this; 68 + } 69 + 64 70 public function execute() { 65 71 $table = new DifferentialTransactionComment(); 66 72 $conn_r = $table->establishConnection('r'); ··· 73 79 $this->buildLimitClause($conn_r)); 74 80 75 81 $comments = $table->loadAllFromArray($data); 82 + 83 + if ($this->withEmpty !== null) { 84 + $want_empty = (bool)$this->withEmpty; 85 + foreach ($comments as $key => $value) { 86 + if ($value->isEmptyInlineComment() !== $want_empty) { 87 + unset($comments[$key]); 88 + } 89 + } 90 + } 76 91 77 92 if ($this->needHidden) { 78 93 $viewer_phid = $this->getViewer()->getPHID();