@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.) hq.recaptime.dev/wiki/Phorge
phorge phabricator
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Add a "Comment content" field to Herald

Summary: Ref T13583. To improve support for making it harder to improperly mix data retention policies, allow Herald to act on comment content.

Test Plan:
- Wrote comment content Herald rules in Maniphest and Differential.
- Submitted non-matching comments (no action) and matching comments (Herald action).
- In Differential, triggered rules by submitting non-matching main content and a matching inline comment.

Maniphest Tasks: T13583

Differential Revision: https://secure.phabricator.com/D21479

+45
+2
src/__phutil_library_map__.php
··· 1557 1557 'HeraldBuildableState' => 'applications/herald/state/HeraldBuildableState.php', 1558 1558 'HeraldCallWebhookAction' => 'applications/herald/action/HeraldCallWebhookAction.php', 1559 1559 'HeraldCommentAction' => 'applications/herald/action/HeraldCommentAction.php', 1560 + 'HeraldCommentContentField' => 'applications/herald/field/HeraldCommentContentField.php', 1560 1561 'HeraldCommitAdapter' => 'applications/diffusion/herald/HeraldCommitAdapter.php', 1561 1562 'HeraldCondition' => 'applications/herald/storage/HeraldCondition.php', 1562 1563 'HeraldConditionTranscript' => 'applications/herald/storage/transcript/HeraldConditionTranscript.php', ··· 7770 7771 'HeraldBuildableState' => 'HeraldState', 7771 7772 'HeraldCallWebhookAction' => 'HeraldAction', 7772 7773 'HeraldCommentAction' => 'HeraldAction', 7774 + 'HeraldCommentContentField' => 'HeraldField', 7773 7775 'HeraldCommitAdapter' => array( 7774 7776 'HeraldAdapter', 7775 7777 'HarbormasterBuildableAdapterInterface',
+43
src/applications/herald/field/HeraldCommentContentField.php
··· 1 + <?php 2 + 3 + final class HeraldCommentContentField extends HeraldField { 4 + 5 + const FIELDCONST = 'comment.content'; 6 + 7 + public function getHeraldFieldName() { 8 + return pht('Comment content'); 9 + } 10 + 11 + public function getFieldGroupKey() { 12 + return HeraldTransactionsFieldGroup::FIELDGROUPKEY; 13 + } 14 + 15 + public function getHeraldFieldValue($object) { 16 + $adapter = $this->getAdapter(); 17 + 18 + $xactions = $adapter->getAppliedTransactions(); 19 + 20 + $result = array(); 21 + foreach ($xactions as $xaction) { 22 + if (!$xaction->hasComment()) { 23 + continue; 24 + } 25 + 26 + $comment = $xaction->getComment(); 27 + $content = $comment->getContent(); 28 + 29 + $result[] = $content; 30 + } 31 + 32 + return $result; 33 + } 34 + 35 + public function supportsObject($object) { 36 + return true; 37 + } 38 + 39 + protected function getHeraldFieldStandardType() { 40 + return self::STANDARD_TEXT_LIST; 41 + } 42 + 43 + }