diff --git a/src/applications/maniphest/editor/ManiphestEditEngine.php b/src/applications/maniphest/editor/ManiphestEditEngine.php --- a/src/applications/maniphest/editor/ManiphestEditEngine.php +++ b/src/applications/maniphest/editor/ManiphestEditEngine.php @@ -69,6 +69,28 @@ return pht('Set Sail for Adventure'); } + /** + * Set a placeholder text in the Maniphest task comment field. + * + * @param string PHID of the task the comment field is displayed in + * @return string Placeholder text to display + */ + public function getCommentFieldPlaceholderText($object_phid) { + $viewer = $this->getViewer(); + $query = id(new ManiphestTaskQuery()) + ->setViewer($viewer) + ->needSubscriberPHIDs(false) + ->needProjectPHIDs(false); + $query->withPHIDs(array($object_phid)); + $task = $query->executeOne(); + + if ($task->getStatus() === ManiphestTaskStatus::STATUS_CLOSED_DUPLICATE) { + return pht('This task is closed as a duplicate. '. + 'Only comment if you think that this task is not a duplicate.'); + } + return ''; + } + protected function getObjectViewURI($object) { return '/'.$object->getMonogram(); } diff --git a/src/applications/transactions/editengine/PhabricatorEditEngine.php b/src/applications/transactions/editengine/PhabricatorEditEngine.php --- a/src/applications/transactions/editengine/PhabricatorEditEngine.php +++ b/src/applications/transactions/editengine/PhabricatorEditEngine.php @@ -1668,6 +1668,7 @@ ->setHeaderText($header_text) ->setAction($comment_uri) ->setRequiresMFA($requires_mfa) + ->setEditEngine($this) ->setSubmitButtonName($button_text); $draft = PhabricatorVersionedDraft::loadDraft( diff --git a/src/applications/transactions/view/PhabricatorApplicationTransactionCommentView.php b/src/applications/transactions/view/PhabricatorApplicationTransactionCommentView.php --- a/src/applications/transactions/view/PhabricatorApplicationTransactionCommentView.php +++ b/src/applications/transactions/view/PhabricatorApplicationTransactionCommentView.php @@ -20,6 +20,7 @@ private $noPermission; private $fullWidth; private $infoView; + private $editEngine; private $editEngineLock; private $noBorder; private $requiresMFA; @@ -150,6 +151,15 @@ return $this->noPermission; } + public function setEditEngine(PhabricatorEditEngine $edit_engine) { + $this->editEngine = $edit_engine; + return $this; + } + + public function getEditEngine() { + return $this->editEngine; + } + public function setEditEngineLock(PhabricatorEditEngineLock $lock) { $this->editEngineLock = $lock; return $this; @@ -296,12 +306,22 @@ private function renderCommentPanel() { $viewer = $this->getViewer(); + // Placeholder text in the