mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-22 23:02:42 +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:
parent
fa569c35d3
commit
d73df58cc6
6 changed files with 20 additions and 4 deletions
|
@ -4,7 +4,7 @@ final class PhabricatorBadgesEditConduitAPIMethod
|
||||||
extends PhabricatorEditEngineAPIMethod {
|
extends PhabricatorEditEngineAPIMethod {
|
||||||
|
|
||||||
public function getAPIMethodName() {
|
public function getAPIMethodName() {
|
||||||
return 'badges.edit';
|
return 'badge.edit';
|
||||||
}
|
}
|
||||||
|
|
||||||
public function newEditEngine() {
|
public function newEditEngine() {
|
||||||
|
|
|
@ -4,7 +4,7 @@ final class PhabricatorBadgesSearchConduitAPIMethod
|
||||||
extends PhabricatorSearchEngineAPIMethod {
|
extends PhabricatorSearchEngineAPIMethod {
|
||||||
|
|
||||||
public function getAPIMethodName() {
|
public function getAPIMethodName() {
|
||||||
return 'badges.search';
|
return 'badge.search';
|
||||||
}
|
}
|
||||||
|
|
||||||
public function newSearchEngine() {
|
public function newSearchEngine() {
|
||||||
|
|
|
@ -26,7 +26,7 @@ final class PhabricatorBadgesAwardTestDataGenerator
|
||||||
'objectIdentifier' => $badge_phid,
|
'objectIdentifier' => $badge_phid,
|
||||||
);
|
);
|
||||||
|
|
||||||
$result = id(new ConduitCall('badges.edit', $params))
|
$result = id(new ConduitCall('badge.edit', $params))
|
||||||
->setUser($author)
|
->setUser($author)
|
||||||
->execute();
|
->execute();
|
||||||
|
|
||||||
|
|
|
@ -40,7 +40,7 @@ final class PhabricatorBadgesBadgeTestDataGenerator
|
||||||
'transactions' => $xactions,
|
'transactions' => $xactions,
|
||||||
);
|
);
|
||||||
|
|
||||||
$result = id(new ConduitCall('badges.edit', $params))
|
$result = id(new ConduitCall('badge.edit', $params))
|
||||||
->setUser($author)
|
->setUser($author)
|
||||||
->execute();
|
->execute();
|
||||||
|
|
||||||
|
|
|
@ -24,6 +24,7 @@ final class PhabricatorBadgesSearchEngine
|
||||||
id(new PhabricatorSearchCheckboxesField())
|
id(new PhabricatorSearchCheckboxesField())
|
||||||
->setKey('qualities')
|
->setKey('qualities')
|
||||||
->setLabel(pht('Quality'))
|
->setLabel(pht('Quality'))
|
||||||
|
->setEnableForConduit(false)
|
||||||
->setOptions(PhabricatorBadgesQuality::getDropdownQualityMap()),
|
->setOptions(PhabricatorBadgesQuality::getDropdownQualityMap()),
|
||||||
id(new PhabricatorSearchCheckboxesField())
|
id(new PhabricatorSearchCheckboxesField())
|
||||||
->setKey('statuses')
|
->setKey('statuses')
|
||||||
|
|
|
@ -19,6 +19,8 @@ abstract class PhabricatorSearchField extends Phobject {
|
||||||
private $description;
|
private $description;
|
||||||
private $isHidden;
|
private $isHidden;
|
||||||
|
|
||||||
|
private $enableForConduit = true;
|
||||||
|
|
||||||
|
|
||||||
/* -( Configuring Fields )------------------------------------------------- */
|
/* -( Configuring Fields )------------------------------------------------- */
|
||||||
|
|
||||||
|
@ -333,6 +335,10 @@ abstract class PhabricatorSearchField extends Phobject {
|
||||||
* @task conduit
|
* @task conduit
|
||||||
*/
|
*/
|
||||||
final public function getConduitParameterType() {
|
final public function getConduitParameterType() {
|
||||||
|
if (!$this->getEnableForConduit()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
$type = $this->newConduitParameterType();
|
$type = $this->newConduitParameterType();
|
||||||
|
|
||||||
if ($type) {
|
if ($type) {
|
||||||
|
@ -367,6 +373,15 @@ abstract class PhabricatorSearchField extends Phobject {
|
||||||
$this->getConduitKey());
|
$this->getConduitKey());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
final public function setEnableForConduit($enable) {
|
||||||
|
$this->enableForConduit = $enable;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
final public function getEnableForConduit() {
|
||||||
|
return $this->enableForConduit;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/* -( Utility Methods )----------------------------------------------------- */
|
/* -( Utility Methods )----------------------------------------------------- */
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue