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

Modularize all remaining Phriction Herald fields

Summary: Ref T8726.

Test Plan:
- Created a rule using all the fields.
- Updated documents, saw rule apply, reviewed transcript.
- Migrated stuff.

Reviewers: btrahan

Reviewed By: btrahan

Subscribers: eadler, epriestley

Maniphest Tasks: T8726

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

+139 -52
+20
resources/sql/autopatches/20150701.herald.2.sql
··· 1 + UPDATE {$NAMESPACE}_herald.herald_condition c 2 + JOIN {$NAMESPACE}_herald.herald_rule r 3 + ON c.ruleID = r.id 4 + SET c.fieldName = 'phriction.document.title' 5 + WHERE r.contentType = 'PhrictionDocumentHeraldAdapter' 6 + AND c.fieldName = 'title'; 7 + 8 + UPDATE {$NAMESPACE}_herald.herald_condition c 9 + JOIN {$NAMESPACE}_herald.herald_rule r 10 + ON c.ruleID = r.id 11 + SET c.fieldName = 'phriction.document.content' 12 + WHERE r.contentType = 'PhrictionDocumentHeraldAdapter' 13 + AND c.fieldName = 'body'; 14 + 15 + UPDATE {$NAMESPACE}_herald.herald_condition c 16 + JOIN {$NAMESPACE}_herald.herald_rule r 17 + ON c.ruleID = r.id 18 + SET c.fieldName = 'phriction.document.author' 19 + WHERE r.contentType = 'PhrictionDocumentHeraldAdapter' 20 + AND c.fieldName = 'author';
+10
src/__phutil_library_map__.php
··· 3159 3159 'PhrictionDeleteController' => 'applications/phriction/controller/PhrictionDeleteController.php', 3160 3160 'PhrictionDiffController' => 'applications/phriction/controller/PhrictionDiffController.php', 3161 3161 'PhrictionDocument' => 'applications/phriction/storage/PhrictionDocument.php', 3162 + 'PhrictionDocumentAuthorHeraldField' => 'applications/phriction/herald/PhrictionDocumentAuthorHeraldField.php', 3163 + 'PhrictionDocumentContentHeraldField' => 'applications/phriction/herald/PhrictionDocumentContentHeraldField.php', 3162 3164 'PhrictionDocumentController' => 'applications/phriction/controller/PhrictionDocumentController.php', 3163 3165 'PhrictionDocumentHeraldAdapter' => 'applications/phriction/herald/PhrictionDocumentHeraldAdapter.php', 3166 + 'PhrictionDocumentHeraldField' => 'applications/phriction/herald/PhrictionDocumentHeraldField.php', 3164 3167 'PhrictionDocumentPHIDType' => 'applications/phriction/phid/PhrictionDocumentPHIDType.php', 3168 + 'PhrictionDocumentPathHeraldField' => 'applications/phriction/herald/PhrictionDocumentPathHeraldField.php', 3165 3169 'PhrictionDocumentQuery' => 'applications/phriction/query/PhrictionDocumentQuery.php', 3166 3170 'PhrictionDocumentStatus' => 'applications/phriction/constants/PhrictionDocumentStatus.php', 3171 + 'PhrictionDocumentTitleHeraldField' => 'applications/phriction/herald/PhrictionDocumentTitleHeraldField.php', 3167 3172 'PhrictionEditConduitAPIMethod' => 'applications/phriction/conduit/PhrictionEditConduitAPIMethod.php', 3168 3173 'PhrictionEditController' => 'applications/phriction/controller/PhrictionEditController.php', 3169 3174 'PhrictionHistoryConduitAPIMethod' => 'applications/phriction/conduit/PhrictionHistoryConduitAPIMethod.php', ··· 7090 7095 'PhabricatorDestructibleInterface', 7091 7096 'PhabricatorApplicationTransactionInterface', 7092 7097 ), 7098 + 'PhrictionDocumentAuthorHeraldField' => 'PhrictionDocumentHeraldField', 7099 + 'PhrictionDocumentContentHeraldField' => 'PhrictionDocumentHeraldField', 7093 7100 'PhrictionDocumentController' => 'PhrictionController', 7094 7101 'PhrictionDocumentHeraldAdapter' => 'HeraldAdapter', 7102 + 'PhrictionDocumentHeraldField' => 'HeraldField', 7095 7103 'PhrictionDocumentPHIDType' => 'PhabricatorPHIDType', 7104 + 'PhrictionDocumentPathHeraldField' => 'PhrictionDocumentHeraldField', 7096 7105 'PhrictionDocumentQuery' => 'PhabricatorCursorPagedPolicyAwareQuery', 7097 7106 'PhrictionDocumentStatus' => 'PhrictionConstants', 7107 + 'PhrictionDocumentTitleHeraldField' => 'PhrictionDocumentHeraldField', 7098 7108 'PhrictionEditConduitAPIMethod' => 'PhrictionConduitAPIMethod', 7099 7109 'PhrictionEditController' => 'PhrictionController', 7100 7110 'PhrictionHistoryConduitAPIMethod' => 'PhrictionConduitAPIMethod',
+4 -4
src/applications/herald/adapter/HeraldAdapter.php
··· 29 29 const FIELD_AUTHOR_RAW = 'author-raw'; 30 30 const FIELD_COMMITTER_RAW = 'committer-raw'; 31 31 const FIELD_PUSHER_IS_COMMITTER = 'pusher-is-committer'; 32 - const FIELD_PATH = 'path'; 33 32 34 33 const CONDITION_CONTAINS = 'contains'; 35 34 const CONDITION_NOT_CONTAINS = '!contains'; ··· 174 173 return $this->applicationEmail; 175 174 } 176 175 177 - abstract public function getPHID(); 176 + public function getPHID() { 177 + return $this->getObject()->getPHID(); 178 + } 179 + 178 180 abstract public function getHeraldName(); 179 181 180 182 public function getHeraldField($field_name) { ··· 389 391 self::FIELD_AUTHOR_RAW => pht('Raw author name'), 390 392 self::FIELD_COMMITTER_RAW => pht('Raw committer name'), 391 393 self::FIELD_PUSHER_IS_COMMITTER => pht('Pusher same as committer'), 392 - self::FIELD_PATH => pht('Path'), 393 394 ); 394 395 } 395 396 ··· 436 437 case self::FIELD_BODY: 437 438 case self::FIELD_COMMITTER_RAW: 438 439 case self::FIELD_AUTHOR_RAW: 439 - case self::FIELD_PATH: 440 440 return array( 441 441 self::CONDITION_CONTAINS, 442 442 self::CONDITION_NOT_CONTAINS,
-4
src/applications/maniphest/herald/HeraldManiphestTaskAdapter.php
··· 93 93 } 94 94 } 95 95 96 - public function getPHID() { 97 - return $this->getTask()->getPHID(); 98 - } 99 - 100 96 public function getHeraldName() { 101 97 return 'T'.$this->getTask()->getID(); 102 98 }
-4
src/applications/pholio/herald/HeraldPholioMockAdapter.php
··· 69 69 } 70 70 } 71 71 72 - public function getPHID() { 73 - return $this->getMock()->getPHID(); 74 - } 75 - 76 72 public function getHeraldName() { 77 73 return 'M'.$this->getMock()->getID(); 78 74 }
+24
src/applications/phriction/herald/PhrictionDocumentAuthorHeraldField.php
··· 1 + <?php 2 + 3 + final class PhrictionDocumentAuthorHeraldField 4 + extends PhrictionDocumentHeraldField { 5 + 6 + const FIELDCONST = 'phriction.document.author'; 7 + 8 + public function getHeraldFieldName() { 9 + return pht('Author'); 10 + } 11 + 12 + public function getHeraldFieldValue($object) { 13 + return $object->getContent()->getAuthorPHID(); 14 + } 15 + 16 + protected function getHeraldFieldStandardConditions() { 17 + return self::STANDARD_PHID; 18 + } 19 + 20 + public function getHeraldFieldValueType($condition) { 21 + return HeraldAdapter::VALUE_USER; 22 + } 23 + 24 + }
+24
src/applications/phriction/herald/PhrictionDocumentContentHeraldField.php
··· 1 + <?php 2 + 3 + final class PhrictionDocumentContentHeraldField 4 + extends PhrictionDocumentHeraldField { 5 + 6 + const FIELDCONST = 'phriction.document.content'; 7 + 8 + public function getHeraldFieldName() { 9 + return pht('Content'); 10 + } 11 + 12 + public function getHeraldFieldValue($object) { 13 + return $object->getContent()->getContent(); 14 + } 15 + 16 + protected function getHeraldFieldStandardConditions() { 17 + return self::STANDARD_TEXT; 18 + } 19 + 20 + public function getHeraldFieldValueType($condition) { 21 + return HeraldAdapter::VALUE_TEXT; 22 + } 23 + 24 + }
-40
src/applications/phriction/herald/PhrictionDocumentHeraldAdapter.php
··· 48 48 } 49 49 } 50 50 51 - public function getFields() { 52 - return array_merge( 53 - array( 54 - self::FIELD_TITLE, 55 - self::FIELD_BODY, 56 - self::FIELD_AUTHOR, 57 - self::FIELD_PATH, 58 - ), 59 - parent::getFields()); 60 - } 61 - 62 51 public function getActions($rule_type) { 63 52 switch ($rule_type) { 64 53 case HeraldRuleTypeConfig::RULE_TYPE_GLOBAL: ··· 83 72 } 84 73 } 85 74 86 - public function getPHID() { 87 - return $this->getDocument()->getPHID(); 88 - } 89 75 90 76 public function getHeraldName() { 91 77 return pht('Wiki Document %d', $this->getDocument()->getID()); 92 - } 93 - 94 - public function getHeraldField($field) { 95 - switch ($field) { 96 - case self::FIELD_TITLE: 97 - return $this->getDocument()->getContent()->getTitle(); 98 - case self::FIELD_BODY: 99 - return $this->getDocument()->getContent()->getContent(); 100 - case self::FIELD_AUTHOR: 101 - return $this->getDocument()->getContent()->getAuthorPHID(); 102 - case self::FIELD_PATH: 103 - return $this->getDocument()->getContent()->getSlug(); 104 - } 105 - 106 - return parent::getHeraldField($field); 107 - } 108 - 109 - public function applyHeraldEffects(array $effects) { 110 - assert_instances_of($effects, 'HeraldEffect'); 111 - 112 - $result = array(); 113 - foreach ($effects as $effect) { 114 - $result[] = $this->applyStandardEffect($effect); 115 - } 116 - 117 - return $result; 118 78 } 119 79 120 80 }
+9
src/applications/phriction/herald/PhrictionDocumentHeraldField.php
··· 1 + <?php 2 + 3 + abstract class PhrictionDocumentHeraldField extends HeraldField { 4 + 5 + public function supportsObject($object) { 6 + return ($object instanceof PhrictionDocument); 7 + } 8 + 9 + }
+24
src/applications/phriction/herald/PhrictionDocumentPathHeraldField.php
··· 1 + <?php 2 + 3 + final class PhrictionDocumentPathHeraldField 4 + extends PhrictionDocumentHeraldField { 5 + 6 + const FIELDCONST = 'path'; 7 + 8 + public function getHeraldFieldName() { 9 + return pht('Path'); 10 + } 11 + 12 + public function getHeraldFieldValue($object) { 13 + return $object->getcontent()->getSlug(); 14 + } 15 + 16 + protected function getHeraldFieldStandardConditions() { 17 + return self::STANDARD_TEXT; 18 + } 19 + 20 + public function getHeraldFieldValueType($condition) { 21 + return HeraldAdapter::VALUE_TEXT; 22 + } 23 + 24 + }
+24
src/applications/phriction/herald/PhrictionDocumentTitleHeraldField.php
··· 1 + <?php 2 + 3 + final class PhrictionDocumentTitleHeraldField 4 + extends PhrictionDocumentHeraldField { 5 + 6 + const FIELDCONST = 'phriction.document.title'; 7 + 8 + public function getHeraldFieldName() { 9 + return pht('Title'); 10 + } 11 + 12 + public function getHeraldFieldValue($object) { 13 + return $object->getContent()->getTitle(); 14 + } 15 + 16 + protected function getHeraldFieldStandardConditions() { 17 + return self::STANDARD_TEXT; 18 + } 19 + 20 + public function getHeraldFieldValueType($condition) { 21 + return HeraldAdapter::VALUE_TEXT; 22 + } 23 + 24 + }