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

Correctly clear draft markers when deleting an inline comment

Summary:
Fixes T8917. Prior to T2618, deleting inlines prompted users, then really deleted the rows.

After T2618, we delete immediately and offer "Undo". However, some interactions with drafts were missed, and we were only clearing the "this revision has a draft" flag on one of the delete pathways (when you delete all the comment text, then save the comment).

Make both the "Delete" action and the "Delete All Comment Text + Save" workflows do the same thing: mark the row as deleted, and clear any relevant drafts.

Test Plan:
- Made an inline comment on a clean revision with no "draft comments" marker in the list view.
- Used "delete" to delete it.
- After applying the patch, verified that no "draft commetns" marker appears in the list view.
- Used Delete and Edit + Remove Text + Save to delete comments in Differential and Diffusion.

Reviewers: btrahan, chad

Reviewed By: chad

Subscribers: epriestley

Maniphest Tasks: T8917

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

+30 -3
+16 -1
src/applications/differential/controller/DifferentialInlineCommentEditController.php
··· 131 131 132 132 protected function deleteComment(PhabricatorInlineCommentInterface $inline) { 133 133 $inline->openTransaction(); 134 + 135 + $inline->setIsDeleted(1)->save(); 134 136 DifferentialDraft::deleteHasDraft( 135 137 $inline->getAuthorPHID(), 136 138 $inline->getRevisionPHID(), 137 139 $inline->getPHID()); 138 - $inline->delete(); 140 + 141 + $inline->saveTransaction(); 142 + } 143 + 144 + protected function undeleteComment( 145 + PhabricatorInlineCommentInterface $inline) { 146 + $inline->openTransaction(); 147 + 148 + $inline->setIsDeleted(0)->save(); 149 + DifferentialDraft::markHasDraft( 150 + $inline->getAuthorPHID(), 151 + $inline->getRevisionPHID(), 152 + $inline->getPHID()); 153 + 139 154 $inline->saveTransaction(); 140 155 } 141 156
+6 -1
src/applications/diffusion/controller/DiffusionInlineCommentController.php
··· 108 108 } 109 109 110 110 protected function deleteComment(PhabricatorInlineCommentInterface $inline) { 111 - return $inline->delete(); 111 + $inline->setIsDeleted(1)->save(); 112 + } 113 + 114 + protected function undeleteComment( 115 + PhabricatorInlineCommentInterface $inline) { 116 + $inline->setIsDeleted(0)->save(); 112 117 } 113 118 114 119 protected function saveComment(PhabricatorInlineCommentInterface $inline) {
+8 -1
src/infrastructure/diff/PhabricatorInlineCommentController.php
··· 12 12 PhabricatorInlineCommentInterface $inline); 13 13 abstract protected function deleteComment( 14 14 PhabricatorInlineCommentInterface $inline); 15 + abstract protected function undeleteComment( 16 + PhabricatorInlineCommentInterface $inline); 15 17 abstract protected function saveComment( 16 18 PhabricatorInlineCommentInterface $inline); 17 19 ··· 167 169 $is_delete = ($op == 'delete' || $op == 'refdelete'); 168 170 169 171 $inline = $this->loadCommentForEdit($this->getCommentID()); 170 - $inline->setIsDeleted((int)$is_delete)->save(); 172 + 173 + if ($is_delete) { 174 + $this->deleteComment($inline); 175 + } else { 176 + $this->undeleteComment($inline); 177 + } 171 178 172 179 return $this->buildEmptyResponse(); 173 180 case 'edit':