diff --git a/src/__phutil_library_map__.php b/src/__phutil_library_map__.php index b68dc107a6..5f28529e80 100644 --- a/src/__phutil_library_map__.php +++ b/src/__phutil_library_map__.php @@ -1581,6 +1581,7 @@ phutil_register_library_map(array( 'HeraldTextFieldValue' => 'applications/herald/value/HeraldTextFieldValue.php', 'HeraldTokenizerFieldValue' => 'applications/herald/value/HeraldTokenizerFieldValue.php', 'HeraldTransactionQuery' => 'applications/herald/query/HeraldTransactionQuery.php', + 'HeraldTransactionsFieldGroup' => 'applications/herald/field/HeraldTransactionsFieldGroup.php', 'HeraldTranscript' => 'applications/herald/storage/transcript/HeraldTranscript.php', 'HeraldTranscriptController' => 'applications/herald/controller/HeraldTranscriptController.php', 'HeraldTranscriptDestructionEngineExtension' => 'applications/herald/engineextension/HeraldTranscriptDestructionEngineExtension.php', @@ -5334,6 +5335,7 @@ phutil_register_library_map(array( 'PhrictionDocumentPathHeraldField' => 'applications/phriction/herald/PhrictionDocumentPathHeraldField.php', 'PhrictionDocumentPolicyCodex' => 'applications/phriction/codex/PhrictionDocumentPolicyCodex.php', 'PhrictionDocumentPublishTransaction' => 'applications/phriction/xaction/PhrictionDocumentPublishTransaction.php', + 'PhrictionDocumentPublishedHeraldField' => 'applications/phriction/herald/PhrictionDocumentPublishedHeraldField.php', 'PhrictionDocumentQuery' => 'applications/phriction/query/PhrictionDocumentQuery.php', 'PhrictionDocumentSearchConduitAPIMethod' => 'applications/phriction/conduit/PhrictionDocumentSearchConduitAPIMethod.php', 'PhrictionDocumentSearchEngine' => 'applications/phriction/query/PhrictionDocumentSearchEngine.php', @@ -7372,6 +7374,7 @@ phutil_register_library_map(array( 'HeraldTextFieldValue' => 'HeraldFieldValue', 'HeraldTokenizerFieldValue' => 'HeraldFieldValue', 'HeraldTransactionQuery' => 'PhabricatorApplicationTransactionQuery', + 'HeraldTransactionsFieldGroup' => 'HeraldFieldGroup', 'HeraldTranscript' => array( 'HeraldDAO', 'PhabricatorPolicyInterface', @@ -11815,6 +11818,7 @@ phutil_register_library_map(array( 'PhrictionDocumentPathHeraldField' => 'PhrictionDocumentHeraldField', 'PhrictionDocumentPolicyCodex' => 'PhabricatorPolicyCodex', 'PhrictionDocumentPublishTransaction' => 'PhrictionDocumentTransactionType', + 'PhrictionDocumentPublishedHeraldField' => 'PhrictionDocumentHeraldField', 'PhrictionDocumentQuery' => 'PhabricatorCursorPagedPolicyAwareQuery', 'PhrictionDocumentSearchConduitAPIMethod' => 'PhabricatorSearchEngineAPIMethod', 'PhrictionDocumentSearchEngine' => 'PhabricatorApplicationSearchEngine', diff --git a/src/applications/herald/field/HeraldField.php b/src/applications/herald/field/HeraldField.php index 408a76f7fb..611ea2cdb3 100644 --- a/src/applications/herald/field/HeraldField.php +++ b/src/applications/herald/field/HeraldField.php @@ -202,4 +202,20 @@ abstract class HeraldField extends Phobject { ->execute(); } + final protected function hasAppliedTransactionOfType($type) { + $xactions = $this->getAdapter()->getAppliedTransactions(); + + if (!$xactions) { + return false; + } + + foreach ($xactions as $xaction) { + if ($xaction->getTransactionType() === $type) { + return true; + } + } + + return false; + } + } diff --git a/src/applications/herald/field/HeraldTransactionsFieldGroup.php b/src/applications/herald/field/HeraldTransactionsFieldGroup.php new file mode 100644 index 0000000000..6198578492 --- /dev/null +++ b/src/applications/herald/field/HeraldTransactionsFieldGroup.php @@ -0,0 +1,15 @@ +hasAppliedTransactionOfType($type_content)) { + return true; + } + + if ($this->hasAppliedTransactionOfType($type_publish)) { + return true; + } + + return false; + } + + protected function getHeraldFieldStandardType() { + return self::STANDARD_BOOL; + } + +}