@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

Prevent use of the "quality" constraint in the Badge search API

Summary:
Ref T12270. This just drops the constraint for now, rather than dealing with all the typecasting stuff and putting us in a position which will almost certainly require backward compatibility breaks in the future.

Also renames "badges.*" to "badge.*" for consistency (all other methods are singular: token.*, project.*, differential.revision.*, etc).

Test Plan:
Saw "qualities" now "Not Supported", while other constraints continue to work:

{F3887194}

Reviewers: chad

Reviewed By: chad

Maniphest Tasks: T12270

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

+20 -4
+1 -1
src/applications/badges/conduit/PhabricatorBadgesEditConduitAPIMethod.php
··· 4 4 extends PhabricatorEditEngineAPIMethod { 5 5 6 6 public function getAPIMethodName() { 7 - return 'badges.edit'; 7 + return 'badge.edit'; 8 8 } 9 9 10 10 public function newEditEngine() {
+1 -1
src/applications/badges/conduit/PhabricatorBadgesSearchConduitAPIMethod.php
··· 4 4 extends PhabricatorSearchEngineAPIMethod { 5 5 6 6 public function getAPIMethodName() { 7 - return 'badges.search'; 7 + return 'badge.search'; 8 8 } 9 9 10 10 public function newSearchEngine() {
+1 -1
src/applications/badges/lipsum/PhabricatorBadgesAwardTestDataGenerator.php
··· 26 26 'objectIdentifier' => $badge_phid, 27 27 ); 28 28 29 - $result = id(new ConduitCall('badges.edit', $params)) 29 + $result = id(new ConduitCall('badge.edit', $params)) 30 30 ->setUser($author) 31 31 ->execute(); 32 32
+1 -1
src/applications/badges/lipsum/PhabricatorBadgesBadgeTestDataGenerator.php
··· 40 40 'transactions' => $xactions, 41 41 ); 42 42 43 - $result = id(new ConduitCall('badges.edit', $params)) 43 + $result = id(new ConduitCall('badge.edit', $params)) 44 44 ->setUser($author) 45 45 ->execute(); 46 46
+1
src/applications/badges/query/PhabricatorBadgesSearchEngine.php
··· 24 24 id(new PhabricatorSearchCheckboxesField()) 25 25 ->setKey('qualities') 26 26 ->setLabel(pht('Quality')) 27 + ->setEnableForConduit(false) 27 28 ->setOptions(PhabricatorBadgesQuality::getDropdownQualityMap()), 28 29 id(new PhabricatorSearchCheckboxesField()) 29 30 ->setKey('statuses')
+15
src/applications/search/field/PhabricatorSearchField.php
··· 19 19 private $description; 20 20 private $isHidden; 21 21 22 + private $enableForConduit = true; 23 + 22 24 23 25 /* -( Configuring Fields )------------------------------------------------- */ 24 26 ··· 333 335 * @task conduit 334 336 */ 335 337 final public function getConduitParameterType() { 338 + if (!$this->getEnableForConduit()) { 339 + return false; 340 + } 341 + 336 342 $type = $this->newConduitParameterType(); 337 343 338 344 if ($type) { ··· 365 371 public function getValidConstraintKeys() { 366 372 return $this->getConduitParameterType()->getKeys( 367 373 $this->getConduitKey()); 374 + } 375 + 376 + final public function setEnableForConduit($enable) { 377 + $this->enableForConduit = $enable; 378 + return $this; 379 + } 380 + 381 + final public function getEnableForConduit() { 382 + return $this->enableForConduit; 368 383 } 369 384 370 385