1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-12-23 14:00:56 +01:00

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
This commit is contained in:
epriestley 2017-03-09 11:32:35 -08:00
parent fa569c35d3
commit d73df58cc6
6 changed files with 20 additions and 4 deletions

View file

@ -4,7 +4,7 @@ final class PhabricatorBadgesEditConduitAPIMethod
extends PhabricatorEditEngineAPIMethod {
public function getAPIMethodName() {
return 'badges.edit';
return 'badge.edit';
}
public function newEditEngine() {

View file

@ -4,7 +4,7 @@ final class PhabricatorBadgesSearchConduitAPIMethod
extends PhabricatorSearchEngineAPIMethod {
public function getAPIMethodName() {
return 'badges.search';
return 'badge.search';
}
public function newSearchEngine() {

View file

@ -26,7 +26,7 @@ final class PhabricatorBadgesAwardTestDataGenerator
'objectIdentifier' => $badge_phid,
);
$result = id(new ConduitCall('badges.edit', $params))
$result = id(new ConduitCall('badge.edit', $params))
->setUser($author)
->execute();

View file

@ -40,7 +40,7 @@ final class PhabricatorBadgesBadgeTestDataGenerator
'transactions' => $xactions,
);
$result = id(new ConduitCall('badges.edit', $params))
$result = id(new ConduitCall('badge.edit', $params))
->setUser($author)
->execute();

View file

@ -24,6 +24,7 @@ final class PhabricatorBadgesSearchEngine
id(new PhabricatorSearchCheckboxesField())
->setKey('qualities')
->setLabel(pht('Quality'))
->setEnableForConduit(false)
->setOptions(PhabricatorBadgesQuality::getDropdownQualityMap()),
id(new PhabricatorSearchCheckboxesField())
->setKey('statuses')

View file

@ -19,6 +19,8 @@ abstract class PhabricatorSearchField extends Phobject {
private $description;
private $isHidden;
private $enableForConduit = true;
/* -( Configuring Fields )------------------------------------------------- */
@ -333,6 +335,10 @@ abstract class PhabricatorSearchField extends Phobject {
* @task conduit
*/
final public function getConduitParameterType() {
if (!$this->getEnableForConduit()) {
return false;
}
$type = $this->newConduitParameterType();
if ($type) {
@ -367,6 +373,15 @@ abstract class PhabricatorSearchField extends Phobject {
$this->getConduitKey());
}
final public function setEnableForConduit($enable) {
$this->enableForConduit = $enable;
return $this;
}
final public function getEnableForConduit() {
return $this->enableForConduit;
}
/* -( Utility Methods )----------------------------------------------------- */