Page MenuHomePhabricator

D21479.diff
No OneTemporary

D21479.diff

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
@@ -1557,6 +1557,7 @@
'HeraldBuildableState' => 'applications/herald/state/HeraldBuildableState.php',
'HeraldCallWebhookAction' => 'applications/herald/action/HeraldCallWebhookAction.php',
'HeraldCommentAction' => 'applications/herald/action/HeraldCommentAction.php',
+ 'HeraldCommentContentField' => 'applications/herald/field/HeraldCommentContentField.php',
'HeraldCommitAdapter' => 'applications/diffusion/herald/HeraldCommitAdapter.php',
'HeraldCondition' => 'applications/herald/storage/HeraldCondition.php',
'HeraldConditionTranscript' => 'applications/herald/storage/transcript/HeraldConditionTranscript.php',
@@ -7770,6 +7771,7 @@
'HeraldBuildableState' => 'HeraldState',
'HeraldCallWebhookAction' => 'HeraldAction',
'HeraldCommentAction' => 'HeraldAction',
+ 'HeraldCommentContentField' => 'HeraldField',
'HeraldCommitAdapter' => array(
'HeraldAdapter',
'HarbormasterBuildableAdapterInterface',
diff --git a/src/applications/herald/field/HeraldCommentContentField.php b/src/applications/herald/field/HeraldCommentContentField.php
new file mode 100644
--- /dev/null
+++ b/src/applications/herald/field/HeraldCommentContentField.php
@@ -0,0 +1,43 @@
+<?php
+
+final class HeraldCommentContentField extends HeraldField {
+
+ const FIELDCONST = 'comment.content';
+
+ public function getHeraldFieldName() {
+ return pht('Comment content');
+ }
+
+ public function getFieldGroupKey() {
+ return HeraldTransactionsFieldGroup::FIELDGROUPKEY;
+ }
+
+ public function getHeraldFieldValue($object) {
+ $adapter = $this->getAdapter();
+
+ $xactions = $adapter->getAppliedTransactions();
+
+ $result = array();
+ foreach ($xactions as $xaction) {
+ if (!$xaction->hasComment()) {
+ continue;
+ }
+
+ $comment = $xaction->getComment();
+ $content = $comment->getContent();
+
+ $result[] = $content;
+ }
+
+ return $result;
+ }
+
+ public function supportsObject($object) {
+ return true;
+ }
+
+ protected function getHeraldFieldStandardType() {
+ return self::STANDARD_TEXT_LIST;
+ }
+
+}

File Metadata

Mime Type
text/plain
Expires
May 12 2024, 4:50 AM (5 w, 8 h ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
6269094
Default Alt Text
D21479.diff (2 KB)

Event Timeline