Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F2872193
D25546.1736883626.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Award Token
Flag For Later
Advanced/Developer...
View Handle
View Hovercard
Size
3 KB
Referenced Files
None
Subscribers
None
D25546.1736883626.diff
View Options
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,29 @@
return pht('Set Sail for Adventure');
}
+ /**
+ * Set a placeholder text in the comment field.
+ *
+ * @param string PHID of the current object the comment field is
+ * displayed in to allow defining rendering conditions
+ * @return string Placeholder text to display in comment field
+ */
+ 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 here if you think that this task is not a duplicate.');
+ }
+ return '';
+ }
+
protected function getObjectViewURI($object) {
return '/'.$object->getMonogram();
}
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
@@ -296,12 +296,38 @@
private function renderCommentPanel() {
$viewer = $this->getViewer();
+ // Set a placeholder text in the comment field defined via
+ // getCommentFieldPlaceholderText() in the object's EditEngine class
+ $placeholder_text = '';
+ $object_phid = $this->getObjectPHID();
+
+ $phid_types = mpull(PhabricatorPHIDType::getAllInstalledTypes($viewer),
+ null, 'getTypeConstant');
+ $object_type = idx($phid_types, substr($object_phid, 5, 4));
+ // Find matching EditEngine for our object via ApplicationClasses
+ if ($object_type) {
+ $app_class = $object_type->getPHIDTypeApplicationClass();
+
+ $engines = id(new PhabricatorEditEngineQuery())
+ ->setViewer($this->getViewer())
+ ->execute();
+ $engines = mpull($engines, null, 'getEngineApplicationClass');
+ $engine = idx($engines, $app_class);
+ $engine_class = get_class($engine);
+
+ if (method_exists($engine_class, 'getCommentFieldPlaceholderText')) {
+ $placeholder_text =
+ $engine->getCommentFieldPlaceholderText($object_phid);
+ }
+ }
+
$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
Details
Attached
Mime Type
text/plain
Expires
Tue, Jan 14, 19:40 (4 d, 7 h ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
1112512
Default Alt Text
D25546.1736883626.diff (3 KB)
Attached To
Mode
D25546: Warn in comment field if task is closed as duplicate
Attached
Detach File
Event Timeline
Log In to Comment