@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.

Modernize Legalpad edge types

Summary: Modernize Legalpad edges to subclass `PhabricatorEdgeType`. Largely based on D11045.

Test Plan:
# Created a Herald rule to require legal signatures on all diffs.
# Created a new diff.
# Saw the transaction string appear correctly.

I wasn't able to check the inverse transaction because there is none. Also, I couldn't see any text on the feed (presumably, transactions authored by Herald do not generate feed items)

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: Krenair, chad, epriestley

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

+121 -13
+4
src/__phutil_library_map__.php
··· 950 950 'LegalpadDocumentSignatureVerificationController' => 'applications/legalpad/controller/LegalpadDocumentSignatureVerificationController.php', 951 951 'LegalpadDocumentSignatureViewController' => 'applications/legalpad/controller/LegalpadDocumentSignatureViewController.php', 952 952 'LegalpadMockMailReceiver' => 'applications/legalpad/mail/LegalpadMockMailReceiver.php', 953 + 'LegalpadObjectNeedsSignatureEdgeType' => 'applications/legalpad/edge/LegalpadObjectNeedsSignatureEdgeType.php', 953 954 'LegalpadReplyHandler' => 'applications/legalpad/mail/LegalpadReplyHandler.php', 954 955 'LegalpadSchemaSpec' => 'applications/legalpad/storage/LegalpadSchemaSpec.php', 956 + 'LegalpadSignatureNeededByObjectEdgeType' => 'applications/legalpad/edge/LegalpadSignatureNeededByObjectEdgeType.php', 955 957 'LegalpadTransaction' => 'applications/legalpad/storage/LegalpadTransaction.php', 956 958 'LegalpadTransactionComment' => 'applications/legalpad/storage/LegalpadTransactionComment.php', 957 959 'LegalpadTransactionQuery' => 'applications/legalpad/query/LegalpadTransactionQuery.php', ··· 4050 4052 'LegalpadDocumentSignatureVerificationController' => 'LegalpadController', 4051 4053 'LegalpadDocumentSignatureViewController' => 'LegalpadController', 4052 4054 'LegalpadMockMailReceiver' => 'PhabricatorObjectMailReceiver', 4055 + 'LegalpadObjectNeedsSignatureEdgeType' => 'PhabricatorEdgeType', 4053 4056 'LegalpadReplyHandler' => 'PhabricatorMailReplyHandler', 4054 4057 'LegalpadSchemaSpec' => 'PhabricatorConfigSchemaSpec', 4058 + 'LegalpadSignatureNeededByObjectEdgeType' => 'PhabricatorEdgeType', 4055 4059 'LegalpadTransaction' => 'PhabricatorApplicationTransaction', 4056 4060 'LegalpadTransactionComment' => 'PhabricatorApplicationTransactionComment', 4057 4061 'LegalpadTransactionQuery' => 'PhabricatorApplicationTransactionQuery',
+1 -1
src/applications/differential/customfield/DifferentialRequiredSignaturesField.php
··· 39 39 40 40 $phids = PhabricatorEdgeQuery::loadDestinationPHIDs( 41 41 $revision->getPHID(), 42 - PhabricatorEdgeConfig::TYPE_OBJECT_NEEDS_SIGNATURE); 42 + LegalpadObjectNeedsSignatureEdgeType::EDGECONST); 43 43 44 44 if ($phids) { 45 45
+1 -1
src/applications/differential/editor/DifferentialTransactionEditor.php
··· 1633 1633 1634 1634 // If we still have something to trigger, add the edges. 1635 1635 if ($legal_phids) { 1636 - $edge_legal = PhabricatorEdgeConfig::TYPE_OBJECT_NEEDS_SIGNATURE; 1636 + $edge_legal = LegalpadObjectNeedsSignatureEdgeType::EDGECONST; 1637 1637 $xactions[] = id(new DifferentialTransaction()) 1638 1638 ->setTransactionType(PhabricatorTransactions::TYPE_EDGE) 1639 1639 ->setMetadataValue('edge:type', $edge_legal)
+102
src/applications/legalpad/edge/LegalpadObjectNeedsSignatureEdgeType.php
··· 1 + <?php 2 + 3 + final class LegalpadObjectNeedsSignatureEdgeType extends PhabricatorEdgeType { 4 + 5 + const EDGECONST = 49; 6 + 7 + public function getInverseEdgeConstant() { 8 + return LegalpadSignatureNeededByObjectEdgeType::EDGECONST; 9 + } 10 + 11 + public function getTransactionAddString( 12 + $actor, 13 + $add_count, 14 + $add_edges) { 15 + 16 + return pht( 17 + '%s added %s required legal document(s): %s.', 18 + $actor, 19 + $add_count, 20 + $add_edges); 21 + } 22 + 23 + public function getTransactionRemoveString( 24 + $actor, 25 + $rem_count, 26 + $rem_edges) { 27 + 28 + return pht( 29 + '%s removed %s required legal document(s): %s.', 30 + $actor, 31 + $rem_count, 32 + $rem_edges); 33 + } 34 + 35 + public function getTransactionEditString( 36 + $actor, 37 + $total_count, 38 + $add_count, 39 + $add_edges, 40 + $rem_count, 41 + $rem_edges) { 42 + 43 + return pht( 44 + '%s edited %s required legal document(s), added %s: %s; removed %s: %s.', 45 + $actor, 46 + $total_count, 47 + $add_count, 48 + $add_edges, 49 + $rem_count, 50 + $rem_edges); 51 + } 52 + 53 + public function getFeedAddString( 54 + $actor, 55 + $object, 56 + $add_count, 57 + $add_edges) { 58 + 59 + return pht( 60 + '%s added %s required legal document(s) to %s: %s.', 61 + $actor, 62 + $add_count, 63 + $object, 64 + $add_edges); 65 + } 66 + 67 + public function getFeedRemoveString( 68 + $actor, 69 + $object, 70 + $rem_count, 71 + $rem_edges) { 72 + 73 + return pht( 74 + '%s removed %s required legal document(s) from %s: %s.', 75 + $actor, 76 + $rem_count, 77 + $object, 78 + $rem_edges); 79 + } 80 + 81 + public function getFeedEditString( 82 + $actor, 83 + $object, 84 + $total_count, 85 + $add_count, 86 + $add_edges, 87 + $rem_count, 88 + $rem_edges) { 89 + 90 + return pht( 91 + '%s edited %s required legal document(s) for %s, '. 92 + 'added %s: %s; removed %s: %s.', 93 + $actor, 94 + $total_count, 95 + $object, 96 + $add_count, 97 + $add_edges, 98 + $rem_count, 99 + $rem_edges); 100 + } 101 + 102 + }
+12
src/applications/legalpad/edge/LegalpadSignatureNeededByObjectEdgeType.php
··· 1 + <?php 2 + 3 + final class LegalpadSignatureNeededByObjectEdgeType 4 + extends PhabricatorEdgeType { 5 + 6 + const EDGECONST = 50; 7 + 8 + public function getInverseEdgeConstant() { 9 + return LegalpadObjectNeedsSignatureEdgeType::EDGECONST; 10 + } 11 + 12 + }
-10
src/infrastructure/edges/constants/PhabricatorEdgeConfig.php
··· 46 46 const TYPE_OBJECT_HAS_WATCHER = 47; 47 47 const TYPE_WATCHER_HAS_OBJECT = 48; 48 48 49 - const TYPE_OBJECT_NEEDS_SIGNATURE = 49; 50 - const TYPE_SIGNATURE_NEEDED_BY_OBJECT = 50; 51 - 52 49 /* !!!! STOP !!!! STOP !!!! STOP !!!! STOP !!!! STOP !!!! STOP !!!! STOP !!!! */ 53 50 54 51 // HEY! DO NOT ADD NEW CONSTANTS HERE! ··· 171 168 172 169 self::TYPE_OBJECT_HAS_WATCHER => self::TYPE_WATCHER_HAS_OBJECT, 173 170 self::TYPE_WATCHER_HAS_OBJECT => self::TYPE_OBJECT_HAS_WATCHER, 174 - 175 - self::TYPE_OBJECT_NEEDS_SIGNATURE => 176 - self::TYPE_SIGNATURE_NEEDED_BY_OBJECT, 177 - self::TYPE_SIGNATURE_NEEDED_BY_OBJECT => 178 - self::TYPE_OBJECT_NEEDS_SIGNATURE, 179 171 ); 180 172 181 173 return idx($map, $edge_type); ··· 308 300 return '%s added %d dashboard(s): %s.'; 309 301 case self::TYPE_OBJECT_HAS_WATCHER: 310 302 return '%s added %d watcher(s): %s.'; 311 - case self::TYPE_OBJECT_NEEDS_SIGNATURE: 312 - return '%s added %d required legal document(s): %s.'; 313 303 case self::TYPE_SUBSCRIBED_TO_OBJECT: 314 304 case self::TYPE_UNSUBSCRIBED_FROM_OBJECT: 315 305 case self::TYPE_FILE_HAS_OBJECT:
+1 -1
src/infrastructure/internationalization/translation/PhabricatorBaseEnglishTranslation.php
··· 914 914 ), 915 915 ), 916 916 917 - '%s added %d required legal document(s): %s.' => array( 917 + '%s added %s required legal document(s): %s.' => array( 918 918 array( 919 919 '%s added a required legal document: %3$s.', 920 920 '%s added required legal documents: %3$s.',