mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-10 00:42:41 +01:00
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
This commit is contained in:
parent
ffa4cae627
commit
f1222f956a
3 changed files with 30 additions and 3 deletions
|
@ -131,11 +131,26 @@ final class DifferentialInlineCommentEditController
|
|||
|
||||
protected function deleteComment(PhabricatorInlineCommentInterface $inline) {
|
||||
$inline->openTransaction();
|
||||
|
||||
$inline->setIsDeleted(1)->save();
|
||||
DifferentialDraft::deleteHasDraft(
|
||||
$inline->getAuthorPHID(),
|
||||
$inline->getRevisionPHID(),
|
||||
$inline->getPHID());
|
||||
$inline->delete();
|
||||
|
||||
$inline->saveTransaction();
|
||||
}
|
||||
|
||||
protected function undeleteComment(
|
||||
PhabricatorInlineCommentInterface $inline) {
|
||||
$inline->openTransaction();
|
||||
|
||||
$inline->setIsDeleted(0)->save();
|
||||
DifferentialDraft::markHasDraft(
|
||||
$inline->getAuthorPHID(),
|
||||
$inline->getRevisionPHID(),
|
||||
$inline->getPHID());
|
||||
|
||||
$inline->saveTransaction();
|
||||
}
|
||||
|
||||
|
|
|
@ -108,7 +108,12 @@ final class DiffusionInlineCommentController
|
|||
}
|
||||
|
||||
protected function deleteComment(PhabricatorInlineCommentInterface $inline) {
|
||||
return $inline->delete();
|
||||
$inline->setIsDeleted(1)->save();
|
||||
}
|
||||
|
||||
protected function undeleteComment(
|
||||
PhabricatorInlineCommentInterface $inline) {
|
||||
$inline->setIsDeleted(0)->save();
|
||||
}
|
||||
|
||||
protected function saveComment(PhabricatorInlineCommentInterface $inline) {
|
||||
|
|
|
@ -12,6 +12,8 @@ abstract class PhabricatorInlineCommentController
|
|||
PhabricatorInlineCommentInterface $inline);
|
||||
abstract protected function deleteComment(
|
||||
PhabricatorInlineCommentInterface $inline);
|
||||
abstract protected function undeleteComment(
|
||||
PhabricatorInlineCommentInterface $inline);
|
||||
abstract protected function saveComment(
|
||||
PhabricatorInlineCommentInterface $inline);
|
||||
|
||||
|
@ -167,7 +169,12 @@ abstract class PhabricatorInlineCommentController
|
|||
$is_delete = ($op == 'delete' || $op == 'refdelete');
|
||||
|
||||
$inline = $this->loadCommentForEdit($this->getCommentID());
|
||||
$inline->setIsDeleted((int)$is_delete)->save();
|
||||
|
||||
if ($is_delete) {
|
||||
$this->deleteComment($inline);
|
||||
} else {
|
||||
$this->undeleteComment($inline);
|
||||
}
|
||||
|
||||
return $this->buildEmptyResponse();
|
||||
case 'edit':
|
||||
|
|
Loading…
Reference in a new issue