From 2a03367a50c0ab2dbeceda0f802bf6e29ae55055 Mon Sep 17 00:00:00 2001 From: epriestley Date: Tue, 4 Sep 2018 11:33:28 -0700 Subject: [PATCH] When authors add inlines to their own revisions/commits, mark them as "Done" by default Summary: Ref T13195. Fixes T8573. When you're adding inlines to your own stuff, mark them "Done" by default. You can unmark them as "Done" if you're legitimately leaving TODOs for yourself, although I think this is unusual. (If this turns out to be less unusual than I think, we could consider an alternate rule: mark replies by the author as "Done" by default.) Test Plan: Added some inlines as an author and a non-author. Saw my author inlines marked as "Done" by default. Submitted them; unmarked and submittted them. Reviewers: amckinley Reviewed By: amckinley Maniphest Tasks: T13195, T8573 Differential Revision: https://secure.phabricator.com/D19635 --- .../diff/PhabricatorInlineCommentController.php | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/infrastructure/diff/PhabricatorInlineCommentController.php b/src/infrastructure/diff/PhabricatorInlineCommentController.php index 22e410612a..e6572672ce 100644 --- a/src/infrastructure/diff/PhabricatorInlineCommentController.php +++ b/src/infrastructure/diff/PhabricatorInlineCommentController.php @@ -231,6 +231,15 @@ abstract class PhabricatorInlineCommentController $inline->setReplyToCommentPHID($this->getReplyToCommentPHID()); } + // If you own this object, mark your own inlines as "Done" by default. + $owner_phid = $this->loadObjectOwnerPHID($inline); + if ($owner_phid) { + if ($viewer->getPHID() == $owner_phid) { + $fixed_state = PhabricatorInlineCommentInterface::STATE_DRAFT; + $inline->setFixedState($fixed_state); + } + } + $this->saveComment($inline); return $this->buildRenderedCommentResponse(