Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F14838263
D18823.id.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
9 KB
Referenced Files
None
Subscribers
None
D18823.id.diff
View Options
diff --git a/resources/celerity/map.php b/resources/celerity/map.php
--- a/resources/celerity/map.php
+++ b/resources/celerity/map.php
@@ -80,7 +80,7 @@
'rsrc/css/application/flag/flag.css' => 'bba8f811',
'rsrc/css/application/harbormaster/harbormaster.css' => 'f491c9f4',
'rsrc/css/application/herald/herald-test.css' => 'a52e323e',
- 'rsrc/css/application/herald/herald.css' => 'dc31f6e9',
+ 'rsrc/css/application/herald/herald.css' => 'cd8d0134',
'rsrc/css/application/maniphest/batch-editor.css' => 'b0f0b6d5',
'rsrc/css/application/maniphest/report.css' => '9b9580b7',
'rsrc/css/application/maniphest/task-edit.css' => 'fda62a9b',
@@ -416,7 +416,7 @@
'rsrc/js/application/drydock/drydock-live-operation-status.js' => '901935ef',
'rsrc/js/application/files/behavior-icon-composer.js' => '8499b6ab',
'rsrc/js/application/files/behavior-launch-icon-composer.js' => '48086888',
- 'rsrc/js/application/herald/HeraldRuleEditor.js' => 'd6a7e717',
+ 'rsrc/js/application/herald/HeraldRuleEditor.js' => '2dff5579',
'rsrc/js/application/herald/PathTypeahead.js' => 'f7fc67ec',
'rsrc/js/application/herald/herald-rule-editor.js' => '7ebaeed3',
'rsrc/js/application/maniphest/behavior-batch-editor.js' => '782ab6e7',
@@ -578,8 +578,8 @@
'font-lato' => 'c7ccd872',
'global-drag-and-drop-css' => 'b556a948',
'harbormaster-css' => 'f491c9f4',
- 'herald-css' => 'dc31f6e9',
- 'herald-rule-editor' => 'd6a7e717',
+ 'herald-css' => 'cd8d0134',
+ 'herald-rule-editor' => '2dff5579',
'herald-test-css' => 'a52e323e',
'inline-comment-summary-css' => 'f23d4e8f',
'javelin-aphlict' => 'e1d4b11a',
@@ -1106,6 +1106,15 @@
'javelin-install',
'javelin-event',
),
+ '2dff5579' => array(
+ 'multirow-row-manager',
+ 'javelin-install',
+ 'javelin-util',
+ 'javelin-dom',
+ 'javelin-stratcom',
+ 'javelin-json',
+ 'phabricator-prefab',
+ ),
'2ee659ce' => array(
'javelin-install',
),
@@ -2001,15 +2010,6 @@
'javelin-dom',
'javelin-stratcom',
),
- 'd6a7e717' => array(
- 'multirow-row-manager',
- 'javelin-install',
- 'javelin-util',
- 'javelin-dom',
- 'javelin-stratcom',
- 'javelin-json',
- 'phabricator-prefab',
- ),
'd7a74243' => array(
'javelin-behavior',
'javelin-stratcom',
diff --git a/src/__phutil_library_map__.php b/src/__phutil_library_map__.php
--- a/src/__phutil_library_map__.php
+++ b/src/__phutil_library_map__.php
@@ -1337,6 +1337,7 @@
'HeraldApplyTranscript' => 'applications/herald/storage/transcript/HeraldApplyTranscript.php',
'HeraldBasicFieldGroup' => 'applications/herald/field/HeraldBasicFieldGroup.php',
'HeraldBuildableState' => 'applications/herald/state/HeraldBuildableState.php',
+ 'HeraldCommentAction' => 'applications/herald/action/HeraldCommentAction.php',
'HeraldCommitAdapter' => 'applications/diffusion/herald/HeraldCommitAdapter.php',
'HeraldCondition' => 'applications/herald/storage/HeraldCondition.php',
'HeraldConditionTranscript' => 'applications/herald/storage/transcript/HeraldConditionTranscript.php',
@@ -1378,6 +1379,7 @@
'HeraldProjectsField' => 'applications/project/herald/HeraldProjectsField.php',
'HeraldRecursiveConditionsException' => 'applications/herald/engine/exception/HeraldRecursiveConditionsException.php',
'HeraldRelatedFieldGroup' => 'applications/herald/field/HeraldRelatedFieldGroup.php',
+ 'HeraldRemarkupFieldValue' => 'applications/herald/value/HeraldRemarkupFieldValue.php',
'HeraldRemarkupRule' => 'applications/herald/remarkup/HeraldRemarkupRule.php',
'HeraldRepetitionPolicyConfig' => 'applications/herald/config/HeraldRepetitionPolicyConfig.php',
'HeraldRule' => 'applications/herald/storage/HeraldRule.php',
@@ -6488,6 +6490,7 @@
'HeraldApplyTranscript' => 'Phobject',
'HeraldBasicFieldGroup' => 'HeraldFieldGroup',
'HeraldBuildableState' => 'HeraldState',
+ 'HeraldCommentAction' => 'HeraldAction',
'HeraldCommitAdapter' => array(
'HeraldAdapter',
'HarbormasterBuildableAdapterInterface',
@@ -6535,6 +6538,7 @@
'HeraldProjectsField' => 'HeraldField',
'HeraldRecursiveConditionsException' => 'Exception',
'HeraldRelatedFieldGroup' => 'HeraldFieldGroup',
+ 'HeraldRemarkupFieldValue' => 'HeraldFieldValue',
'HeraldRemarkupRule' => 'PhabricatorObjectRemarkupRule',
'HeraldRepetitionPolicyConfig' => 'Phobject',
'HeraldRule' => array(
diff --git a/src/applications/herald/action/HeraldAction.php b/src/applications/herald/action/HeraldAction.php
--- a/src/applications/herald/action/HeraldAction.php
+++ b/src/applications/herald/action/HeraldAction.php
@@ -9,6 +9,7 @@
const STANDARD_NONE = 'standard.none';
const STANDARD_PHID_LIST = 'standard.phid.list';
const STANDARD_TEXT = 'standard.text';
+ const STANDARD_REMARKUP = 'standard.remarkup';
const DO_STANDARD_EMPTY = 'do.standard.empty';
const DO_STANDARD_NO_EFFECT = 'do.standard.no-effect';
@@ -60,6 +61,8 @@
return new HeraldEmptyFieldValue();
case self::STANDARD_TEXT:
return new HeraldTextFieldValue();
+ case self::STANDARD_REMARKUP:
+ return new HeraldRemarkupFieldValue();
case self::STANDARD_PHID_LIST:
$tokenizer = id(new HeraldTokenizerFieldValue())
->setKey($this->getHeraldActionName())
diff --git a/src/applications/herald/action/HeraldCommentAction.php b/src/applications/herald/action/HeraldCommentAction.php
new file mode 100644
--- /dev/null
+++ b/src/applications/herald/action/HeraldCommentAction.php
@@ -0,0 +1,79 @@
+<?php
+
+final class HeraldCommentAction extends HeraldAction {
+
+ const ACTIONCONST = 'comment';
+ const DO_COMMENT = 'do.comment';
+
+ public function getHeraldActionName() {
+ return pht('Add comment');
+ }
+
+ public function getActionGroupKey() {
+ return HeraldUtilityActionGroup::ACTIONGROUPKEY;
+ }
+
+ public function supportsObject($object) {
+ if (!($object instanceof PhabricatorApplicationTransactionInterface)) {
+ return false;
+ }
+
+ $xaction = $object->getApplicationTransactionTemplate();
+ try {
+ $comment = $xaction->getApplicationTransactionCommentObject();
+ if (!$comment) {
+ return false;
+ }
+ } catch (PhutilMethodNotImplementedException $ex) {
+ return false;
+ }
+
+ return true;
+ }
+
+ public function supportsRuleType($rule_type) {
+ return ($rule_type != HeraldRuleTypeConfig::RULE_TYPE_PERSONAL);
+ }
+
+ public function applyEffect($object, HeraldEffect $effect) {
+ $adapter = $this->getAdapter();
+ $comment_text = $effect->getTarget();
+
+ $xaction = $adapter->newTransaction()
+ ->setTransactionType(PhabricatorTransactions::TYPE_COMMENT);
+
+ $comment = $xaction->getApplicationTransactionCommentObject()
+ ->setContent($comment_text);
+
+ $xaction->attachComment($comment);
+
+ $adapter->queueTransaction($xaction);
+
+ $this->logEffect(self::DO_COMMENT, $comment_text);
+ }
+
+ public function getHeraldActionStandardType() {
+ return self::STANDARD_REMARKUP;
+ }
+
+ protected function getActionEffectMap() {
+ return array(
+ self::DO_COMMENT => array(
+ 'icon' => 'fa-comment',
+ 'color' => 'blue',
+ 'name' => pht('Added Comment'),
+ ),
+ );
+ }
+
+ public function renderActionDescription($value) {
+ $summary = PhabricatorMarkupEngine::summarize($value);
+ return pht('Add comment: %s', $summary);
+ }
+
+ protected function renderActionEffectDescription($type, $data) {
+ $summary = PhabricatorMarkupEngine::summarize($data);
+ return pht('Added a comment: %s', $summary);
+ }
+
+}
diff --git a/src/applications/herald/value/HeraldFieldValue.php b/src/applications/herald/value/HeraldFieldValue.php
--- a/src/applications/herald/value/HeraldFieldValue.php
+++ b/src/applications/herald/value/HeraldFieldValue.php
@@ -8,6 +8,7 @@
const CONTROL_TEXT = 'herald.control.text';
const CONTROL_SELECT = 'herald.control.select';
const CONTROL_TOKENIZER = 'herald.control.tokenizer';
+ const CONTROL_REMARKUP = 'herald.control.remarkup';
abstract public function getFieldValueKey();
abstract public function getControlType();
diff --git a/src/applications/herald/value/HeraldRemarkupFieldValue.php b/src/applications/herald/value/HeraldRemarkupFieldValue.php
new file mode 100644
--- /dev/null
+++ b/src/applications/herald/value/HeraldRemarkupFieldValue.php
@@ -0,0 +1,22 @@
+<?php
+
+final class HeraldRemarkupFieldValue
+ extends HeraldFieldValue {
+
+ public function getFieldValueKey() {
+ return 'remarkup';
+ }
+
+ public function getControlType() {
+ return self::CONTROL_REMARKUP;
+ }
+
+ public function renderFieldValue($value) {
+ return $value;
+ }
+
+ public function renderEditorValue($value) {
+ return $value;
+ }
+
+}
diff --git a/webroot/rsrc/css/application/herald/herald.css b/webroot/rsrc/css/application/herald/herald.css
--- a/webroot/rsrc/css/application/herald/herald.css
+++ b/webroot/rsrc/css/application/herald/herald.css
@@ -37,6 +37,12 @@
padding: 2px 4px;
}
+.herald-action-table td textarea {
+ width: 95%;
+ height: 8em;
+ padding: 2px 4px;
+}
+
.herald-action-table td.target {
width: 100%;
}
diff --git a/webroot/rsrc/js/application/herald/HeraldRuleEditor.js b/webroot/rsrc/js/application/herald/HeraldRuleEditor.js
--- a/webroot/rsrc/js/application/herald/HeraldRuleEditor.js
+++ b/webroot/rsrc/js/application/herald/HeraldRuleEditor.js
@@ -217,6 +217,11 @@
get_fn = function() { return input.value; };
set_fn = function(v) { input.value = v; };
break;
+ case 'herald.control.remarkup':
+ input = JX.$N('textarea');
+ get_fn = function() { return input.value; };
+ set_fn = function(v) { input.value = v; };
+ break;
case 'herald.control.select':
var options;
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sat, Feb 1, 2:29 PM (6 h, 45 m)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
7082050
Default Alt Text
D18823.id.diff (9 KB)
Attached To
Mode
D18823: Allow Herald rules to add comments
Attached
Detach File
Event Timeline
Log In to Comment