Page MenuHomePhorge

D25546.1737751011.diff
No OneTemporary

D25546.1737751011.diff

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 <textarea> comment field. Defined in the
+ // corresponding EditEngine class via getCommentFieldPlaceholderText()
+ $engine = $this->getEditEngine();
+ $placeholder_text = '';
+ if ($engine && method_exists($engine, 'getCommentFieldPlaceholderText')) {
+ $placeholder_text = $engine
+ ->getCommentFieldPlaceholderText($this->getObjectPHID());
+ }
+
$remarkup_control = id(new PhabricatorRemarkupControl())
->setViewer($viewer)
->setID($this->getCommentID())
->addClass('phui-comment-fullwidth-control')
->addClass('phui-comment-textarea-control')
->setCanPin(true)
+ ->setPlaceholder($placeholder_text)
->setName('comment');
$draft_comment = '';

File Metadata

Mime Type
text/plain
Expires
Fri, Jan 24, 20:36 (1 w, 6 d ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
1147929
Default Alt Text
D25546.1737751011.diff (3 KB)

Event Timeline