@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 `badges.edit` and `badges.search` to Conduit API

Summary: Ref T10671

Test Plan: Open Conduit application, open `badges.edit` or `badges.search`, create, edit, or query for a badge.

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: Korvin

Maniphest Tasks: T10671

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

+84 -2
+5
src/__phutil_library_map__.php
··· 1878 1878 'PhabricatorBadgesCreateCapability' => 'applications/badges/capability/PhabricatorBadgesCreateCapability.php', 1879 1879 'PhabricatorBadgesDAO' => 'applications/badges/storage/PhabricatorBadgesDAO.php', 1880 1880 'PhabricatorBadgesDefaultEditCapability' => 'applications/badges/capability/PhabricatorBadgesDefaultEditCapability.php', 1881 + 'PhabricatorBadgesEditConduitAPIMethod' => 'applications/badges/conduit/PhabricatorBadgesEditConduitAPIMethod.php', 1881 1882 'PhabricatorBadgesEditController' => 'applications/badges/controller/PhabricatorBadgesEditController.php', 1882 1883 'PhabricatorBadgesEditEngine' => 'applications/badges/editor/PhabricatorBadgesEditEngine.php', 1883 1884 'PhabricatorBadgesEditRecipientsController' => 'applications/badges/controller/PhabricatorBadgesEditRecipientsController.php', ··· 1892 1893 'PhabricatorBadgesRemoveRecipientsController' => 'applications/badges/controller/PhabricatorBadgesRemoveRecipientsController.php', 1893 1894 'PhabricatorBadgesReplyHandler' => 'applications/badges/mail/PhabricatorBadgesReplyHandler.php', 1894 1895 'PhabricatorBadgesSchemaSpec' => 'applications/badges/storage/PhabricatorBadgesSchemaSpec.php', 1896 + 'PhabricatorBadgesSearchConduitAPIMethod' => 'applications/badges/conduit/PhabricatorBadgesSearchConduitAPIMethod.php', 1895 1897 'PhabricatorBadgesSearchEngine' => 'applications/badges/query/PhabricatorBadgesSearchEngine.php', 1896 1898 'PhabricatorBadgesTransaction' => 'applications/badges/storage/PhabricatorBadgesTransaction.php', 1897 1899 'PhabricatorBadgesTransactionComment' => 'applications/badges/storage/PhabricatorBadgesTransactionComment.php', ··· 6247 6249 'PhabricatorTokenReceiverInterface', 6248 6250 'PhabricatorFlaggableInterface', 6249 6251 'PhabricatorDestructibleInterface', 6252 + 'PhabricatorConduitResultInterface', 6250 6253 ), 6251 6254 'PhabricatorBadgesCommentController' => 'PhabricatorBadgesController', 6252 6255 'PhabricatorBadgesController' => 'PhabricatorController', 6253 6256 'PhabricatorBadgesCreateCapability' => 'PhabricatorPolicyCapability', 6254 6257 'PhabricatorBadgesDAO' => 'PhabricatorLiskDAO', 6255 6258 'PhabricatorBadgesDefaultEditCapability' => 'PhabricatorPolicyCapability', 6259 + 'PhabricatorBadgesEditConduitAPIMethod' => 'PhabricatorEditEngineAPIMethod', 6256 6260 'PhabricatorBadgesEditController' => 'PhabricatorBadgesController', 6257 6261 'PhabricatorBadgesEditEngine' => 'PhabricatorEditEngine', 6258 6262 'PhabricatorBadgesEditRecipientsController' => 'PhabricatorBadgesController', ··· 6267 6271 'PhabricatorBadgesRemoveRecipientsController' => 'PhabricatorBadgesController', 6268 6272 'PhabricatorBadgesReplyHandler' => 'PhabricatorApplicationTransactionReplyHandler', 6269 6273 'PhabricatorBadgesSchemaSpec' => 'PhabricatorConfigSchemaSpec', 6274 + 'PhabricatorBadgesSearchConduitAPIMethod' => 'PhabricatorSearchEngineAPIMethod', 6270 6275 'PhabricatorBadgesSearchEngine' => 'PhabricatorApplicationSearchEngine', 6271 6276 'PhabricatorBadgesTransaction' => 'PhabricatorApplicationTransaction', 6272 6277 'PhabricatorBadgesTransactionComment' => 'PhabricatorApplicationTransactionComment',
+19
src/applications/badges/conduit/PhabricatorBadgesEditConduitAPIMethod.php
··· 1 + <?php 2 + 3 + final class PhabricatorBadgesEditConduitAPIMethod 4 + extends PhabricatorEditEngineAPIMethod { 5 + 6 + public function getAPIMethodName() { 7 + return 'badges.edit'; 8 + } 9 + 10 + public function newEditEngine() { 11 + return new PhabricatorBadgesEditEngine(); 12 + } 13 + 14 + public function getMethodSummary() { 15 + return pht( 16 + 'Apply transactions to create a new badge or edit an existing one.'); 17 + } 18 + 19 + }
+18
src/applications/badges/conduit/PhabricatorBadgesSearchConduitAPIMethod.php
··· 1 + <?php 2 + 3 + final class PhabricatorBadgesSearchConduitAPIMethod 4 + extends PhabricatorSearchEngineAPIMethod { 5 + 6 + public function getAPIMethodName() { 7 + return 'badges.search'; 8 + } 9 + 10 + public function newSearchEngine() { 11 + return new PhabricatorBadgesSearchEngine(); 12 + } 13 + 14 + public function getMethodSummary() { 15 + return pht('Read information about badges.'); 16 + } 17 + 18 + }
+5
src/applications/badges/editor/PhabricatorBadgesEditEngine.php
··· 81 81 ->setKey('name') 82 82 ->setLabel(pht('Name')) 83 83 ->setDescription(pht('Badge name.')) 84 + ->setConduitTypeDescription(pht('New badge name.')) 84 85 ->setTransactionType(PhabricatorBadgesTransaction::TYPE_NAME) 85 86 ->setValue($object->getName()), 86 87 id(new PhabricatorTextEditField()) 87 88 ->setKey('flavor') 88 89 ->setLabel(pht('Flavor text')) 89 90 ->setDescription(pht('Short description of the badge.')) 91 + ->setConduitTypeDescription(pht('New badge flavor.')) 90 92 ->setValue($object->getFlavor()) 91 93 ->setTransactionType(PhabricatorBadgesTransaction::TYPE_FLAVOR), 92 94 id(new PhabricatorIconSetEditField()) ··· 100 102 id(new PhabricatorSelectEditField()) 101 103 ->setKey('quality') 102 104 ->setLabel(pht('Quality')) 105 + ->setDescription(pht('Color and rarity of the badge.')) 106 + ->setConduitTypeDescription(pht('New badge quality.')) 103 107 ->setValue($object->getQuality()) 104 108 ->setTransactionType(PhabricatorBadgesTransaction::TYPE_QUALITY) 105 109 ->setOptions(PhabricatorBadgesQuality::getDropdownQualityMap()), ··· 107 111 ->setKey('description') 108 112 ->setLabel(pht('Description')) 109 113 ->setDescription(pht('Badge long description.')) 114 + ->setConduitTypeDescription(pht('New badge description.')) 110 115 ->setTransactionType(PhabricatorBadgesTransaction::TYPE_DESCRIPTION) 111 116 ->setValue($object->getDescription()), 112 117 );
+36 -1
src/applications/badges/storage/PhabricatorBadgesBadge.php
··· 7 7 PhabricatorSubscribableInterface, 8 8 PhabricatorTokenReceiverInterface, 9 9 PhabricatorFlaggableInterface, 10 - PhabricatorDestructibleInterface { 10 + PhabricatorDestructibleInterface, 11 + PhabricatorConduitResultInterface { 11 12 12 13 protected $name; 13 14 protected $flavor; ··· 49 50 ->setQuality(PhabricatorBadgesQuality::DEFAULT_QUALITY) 50 51 ->setCreatorPHID($actor->getPHID()) 51 52 ->setEditPolicy($edit_policy) 53 + ->setFlavor('') 54 + ->setDescription('') 52 55 ->setStatus(self::STATUS_ACTIVE); 53 56 } 54 57 ··· 188 191 $this->openTransaction(); 189 192 $this->delete(); 190 193 $this->saveTransaction(); 194 + } 195 + 196 + /* -( PhabricatorConduitResultInterface )---------------------------------- */ 197 + 198 + 199 + public function getFieldSpecificationsForConduit() { 200 + return array( 201 + id(new PhabricatorConduitSearchFieldSpecification()) 202 + ->setKey('name') 203 + ->setType('string') 204 + ->setDescription(pht('The name of the badge.')), 205 + id(new PhabricatorConduitSearchFieldSpecification()) 206 + ->setKey('creatorPHID') 207 + ->setType('phid') 208 + ->setDescription(pht('User PHID of the creator.')), 209 + id(new PhabricatorConduitSearchFieldSpecification()) 210 + ->setKey('status') 211 + ->setType('string') 212 + ->setDescription(pht('Active or archived status of the badge.')), 213 + ); 214 + } 215 + 216 + public function getFieldValuesForConduit() { 217 + return array( 218 + 'name' => $this->getName(), 219 + 'creatorPHID' => $this->getCreatorPHID(), 220 + 'status' => $this->getStatus(), 221 + ); 222 + } 223 + 224 + public function getConduitSearchAttachments() { 225 + return array(); 191 226 } 192 227 193 228 }
+1 -1
src/applications/paste/storage/PhabricatorPaste.php
··· 264 264 id(new PhabricatorConduitSearchFieldSpecification()) 265 265 ->setKey('status') 266 266 ->setType('string') 267 - ->setDescription(pht('Active or arhived status of the paste.')), 267 + ->setDescription(pht('Active or archived status of the paste.')), 268 268 ); 269 269 } 270 270