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 @@ -950,8 +950,10 @@ 'LegalpadDocumentSignatureVerificationController' => 'applications/legalpad/controller/LegalpadDocumentSignatureVerificationController.php', 'LegalpadDocumentSignatureViewController' => 'applications/legalpad/controller/LegalpadDocumentSignatureViewController.php', 'LegalpadMockMailReceiver' => 'applications/legalpad/mail/LegalpadMockMailReceiver.php', + 'LegalpadObjectNeedsSignatureEdgeType' => 'applications/legalpad/edge/LegalpadObjectNeedsSignatureEdgeType.php', 'LegalpadReplyHandler' => 'applications/legalpad/mail/LegalpadReplyHandler.php', 'LegalpadSchemaSpec' => 'applications/legalpad/storage/LegalpadSchemaSpec.php', + 'LegalpadSignatureNeededByObjectEdgeType' => 'applications/legalpad/edge/LegalpadSignatureNeededByObjectEdgeType.php', 'LegalpadTransaction' => 'applications/legalpad/storage/LegalpadTransaction.php', 'LegalpadTransactionComment' => 'applications/legalpad/storage/LegalpadTransactionComment.php', 'LegalpadTransactionQuery' => 'applications/legalpad/query/LegalpadTransactionQuery.php', @@ -4049,8 +4051,10 @@ 'LegalpadDocumentSignatureVerificationController' => 'LegalpadController', 'LegalpadDocumentSignatureViewController' => 'LegalpadController', 'LegalpadMockMailReceiver' => 'PhabricatorObjectMailReceiver', + 'LegalpadObjectNeedsSignatureEdgeType' => 'PhabricatorEdgeType', 'LegalpadReplyHandler' => 'PhabricatorMailReplyHandler', 'LegalpadSchemaSpec' => 'PhabricatorConfigSchemaSpec', + 'LegalpadSignatureNeededByObjectEdgeType' => 'PhabricatorEdgeType', 'LegalpadTransaction' => 'PhabricatorApplicationTransaction', 'LegalpadTransactionComment' => 'PhabricatorApplicationTransactionComment', 'LegalpadTransactionQuery' => 'PhabricatorApplicationTransactionQuery', diff --git a/src/applications/differential/customfield/DifferentialRequiredSignaturesField.php b/src/applications/differential/customfield/DifferentialRequiredSignaturesField.php --- a/src/applications/differential/customfield/DifferentialRequiredSignaturesField.php +++ b/src/applications/differential/customfield/DifferentialRequiredSignaturesField.php @@ -39,7 +39,7 @@ $phids = PhabricatorEdgeQuery::loadDestinationPHIDs( $revision->getPHID(), - PhabricatorEdgeConfig::TYPE_OBJECT_NEEDS_SIGNATURE); + LegalpadObjectNeedsSignatureEdgeType::EDGECONST); if ($phids) { diff --git a/src/applications/differential/editor/DifferentialTransactionEditor.php b/src/applications/differential/editor/DifferentialTransactionEditor.php --- a/src/applications/differential/editor/DifferentialTransactionEditor.php +++ b/src/applications/differential/editor/DifferentialTransactionEditor.php @@ -1633,7 +1633,7 @@ // If we still have something to trigger, add the edges. if ($legal_phids) { - $edge_legal = PhabricatorEdgeConfig::TYPE_OBJECT_NEEDS_SIGNATURE; + $edge_legal = LegalpadObjectNeedsSignatureEdgeType::EDGECONST; $xactions[] = id(new DifferentialTransaction()) ->setTransactionType(PhabricatorTransactions::TYPE_EDGE) ->setMetadataValue('edge:type', $edge_legal) diff --git a/src/applications/legalpad/edge/LegalpadObjectNeedsSignatureEdgeType.php b/src/applications/legalpad/edge/LegalpadObjectNeedsSignatureEdgeType.php new file mode 100644 --- /dev/null +++ b/src/applications/legalpad/edge/LegalpadObjectNeedsSignatureEdgeType.php @@ -0,0 +1,102 @@ +<?php + +final class LegalpadObjectNeedsSignatureEdgeType extends PhabricatorEdgeType { + + const EDGECONST = 49; + + public function getInverseEdgeConstant() { + return LegalpadSignatureNeededByObjectEdgeType::EDGECONST; + } + + public function getTransactionAddString( + $actor, + $add_count, + $add_edges) { + + return pht( + '%s added %s required legal document(s): %s.', + $actor, + $add_count, + $add_edges); + } + + public function getTransactionRemoveString( + $actor, + $rem_count, + $rem_edges) { + + return pht( + '%s removed %s required legal document(s): %s.', + $actor, + $rem_count, + $rem_edges); + } + + public function getTransactionEditString( + $actor, + $total_count, + $add_count, + $add_edges, + $rem_count, + $rem_edges) { + + return pht( + '%s edited %s required legal document(s), added %s: %s; removed %s: %s.', + $actor, + $total_count, + $add_count, + $add_edges, + $rem_count, + $rem_edges); + } + + public function getFeedAddString( + $actor, + $object, + $add_count, + $add_edges) { + + return pht( + '%s added %s required legal document(s) to %s: %s.', + $actor, + $add_count, + $object, + $add_edges); + } + + public function getFeedRemoveString( + $actor, + $object, + $rem_count, + $rem_edges) { + + return pht( + '%s removed %s required legal document(s) from %s: %s.', + $actor, + $rem_count, + $object, + $rem_edges); + } + + public function getFeedEditString( + $actor, + $object, + $total_count, + $add_count, + $add_edges, + $rem_count, + $rem_edges) { + + return pht( + '%s edited %s required legal document(s) for %s, '. + 'added %s: %s; removed %s: %s.', + $actor, + $total_count, + $object, + $add_count, + $add_edges, + $rem_count, + $rem_edges); + } + +} diff --git a/src/applications/legalpad/edge/LegalpadSignatureNeededByObjectEdgeType.php b/src/applications/legalpad/edge/LegalpadSignatureNeededByObjectEdgeType.php new file mode 100644 --- /dev/null +++ b/src/applications/legalpad/edge/LegalpadSignatureNeededByObjectEdgeType.php @@ -0,0 +1,12 @@ +<?php + +final class LegalpadSignatureNeededByObjectEdgeType + extends PhabricatorEdgeType { + + const EDGECONST = 50; + + public function getInverseEdgeConstant() { + return LegalpadObjectNeedsSignatureEdgeType::EDGECONST; + } + +} diff --git a/src/infrastructure/edges/constants/PhabricatorEdgeConfig.php b/src/infrastructure/edges/constants/PhabricatorEdgeConfig.php --- a/src/infrastructure/edges/constants/PhabricatorEdgeConfig.php +++ b/src/infrastructure/edges/constants/PhabricatorEdgeConfig.php @@ -46,9 +46,6 @@ const TYPE_OBJECT_HAS_WATCHER = 47; const TYPE_WATCHER_HAS_OBJECT = 48; - const TYPE_OBJECT_NEEDS_SIGNATURE = 49; - const TYPE_SIGNATURE_NEEDED_BY_OBJECT = 50; - /* !!!! STOP !!!! STOP !!!! STOP !!!! STOP !!!! STOP !!!! STOP !!!! STOP !!!! */ // HEY! DO NOT ADD NEW CONSTANTS HERE! @@ -171,11 +168,6 @@ self::TYPE_OBJECT_HAS_WATCHER => self::TYPE_WATCHER_HAS_OBJECT, self::TYPE_WATCHER_HAS_OBJECT => self::TYPE_OBJECT_HAS_WATCHER, - - self::TYPE_OBJECT_NEEDS_SIGNATURE => - self::TYPE_SIGNATURE_NEEDED_BY_OBJECT, - self::TYPE_SIGNATURE_NEEDED_BY_OBJECT => - self::TYPE_OBJECT_NEEDS_SIGNATURE, ); return idx($map, $edge_type); @@ -308,8 +300,6 @@ return '%s added %d dashboard(s): %s.'; case self::TYPE_OBJECT_HAS_WATCHER: return '%s added %d watcher(s): %s.'; - case self::TYPE_OBJECT_NEEDS_SIGNATURE: - return '%s added %d required legal document(s): %s.'; case self::TYPE_SUBSCRIBED_TO_OBJECT: case self::TYPE_UNSUBSCRIBED_FROM_OBJECT: case self::TYPE_FILE_HAS_OBJECT: diff --git a/src/infrastructure/internationalization/translation/PhabricatorBaseEnglishTranslation.php b/src/infrastructure/internationalization/translation/PhabricatorBaseEnglishTranslation.php --- a/src/infrastructure/internationalization/translation/PhabricatorBaseEnglishTranslation.php +++ b/src/infrastructure/internationalization/translation/PhabricatorBaseEnglishTranslation.php @@ -914,7 +914,7 @@ ), ), - '%s added %d required legal document(s): %s.' => array( + '%s added %s required legal document(s): %s.' => array( array( '%s added a required legal document: %3$s.', '%s added required legal documents: %3$s.',