mirror of
https://we.phorge.it/source/phorge.git
synced 2024-12-29 17:00:59 +01:00
Add 'colors' and 'icons' fields to conduit api for Projects
Summary: This simply adds colors, icons to ProjectQueryConduitAPIMethod and ProjectCreateConduitAPIMethod. Additionally, adds 'tags' to ProjectCreateConduitAPIMethod Change-Id: Ic6332fe174a59ecfd60cea281ccb0ed938136141 Test Plan: create a new project with project.create, specify icon, color and tags call project.query with colors and icons args, check for results containing matching projects. Reviewers: #blessed_reviewers, epriestley Reviewed By: #blessed_reviewers, epriestley Subscribers: legoktm, aklapper, Korvin, epriestley, valhallasw, qgil Differential Revision: https://secure.phabricator.com/D13098
This commit is contained in:
parent
d3a84687ba
commit
dfac9d7f52
2 changed files with 39 additions and 0 deletions
|
@ -14,6 +14,9 @@ final class ProjectCreateConduitAPIMethod extends ProjectConduitAPIMethod {
|
||||||
return array(
|
return array(
|
||||||
'name' => 'required string',
|
'name' => 'required string',
|
||||||
'members' => 'optional list<phid>',
|
'members' => 'optional list<phid>',
|
||||||
|
'icon' => 'optional string',
|
||||||
|
'color' => 'optional string',
|
||||||
|
'tags' => 'optional list<string>',
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -37,6 +40,24 @@ final class ProjectCreateConduitAPIMethod extends ProjectConduitAPIMethod {
|
||||||
->setTransactionType($type_name)
|
->setTransactionType($type_name)
|
||||||
->setNewValue($request->getValue('name'));
|
->setNewValue($request->getValue('name'));
|
||||||
|
|
||||||
|
if ($request->getValue('icon')) {
|
||||||
|
$xactions[] = id(new PhabricatorProjectTransaction())
|
||||||
|
->setTransactionType(PhabricatorProjectTransaction::TYPE_ICON)
|
||||||
|
->setNewValue($request->getValue('icon'));
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($request->getValue('color')) {
|
||||||
|
$xactions[] = id(new PhabricatorProjectTransaction())
|
||||||
|
->setTransactionType(PhabricatorProjectTransaction::TYPE_COLOR)
|
||||||
|
->setNewValue($request->getValue('color'));
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($request->getValue('tags')) {
|
||||||
|
$xactions[] = id(new PhabricatorProjectTransaction())
|
||||||
|
->setTransactionType(PhabricatorProjectTransaction::TYPE_SLUGS)
|
||||||
|
->setNewValue($request->getValue('tags'));
|
||||||
|
}
|
||||||
|
|
||||||
$xactions[] = id(new PhabricatorProjectTransaction())
|
$xactions[] = id(new PhabricatorProjectTransaction())
|
||||||
->setTransactionType(PhabricatorTransactions::TYPE_EDGE)
|
->setTransactionType(PhabricatorTransactions::TYPE_EDGE)
|
||||||
->setMetadataValue(
|
->setMetadataValue(
|
||||||
|
|
|
@ -27,6 +27,8 @@ final class ProjectQueryConduitAPIMethod extends ProjectConduitAPIMethod {
|
||||||
'names' => 'optional list<string>',
|
'names' => 'optional list<string>',
|
||||||
'phids' => 'optional list<phid>',
|
'phids' => 'optional list<phid>',
|
||||||
'slugs' => 'optional list<string>',
|
'slugs' => 'optional list<string>',
|
||||||
|
'icons' => 'optional list<string>',
|
||||||
|
'colors' => 'optional list<string>',
|
||||||
'status' => 'optional '.$status_const,
|
'status' => 'optional '.$status_const,
|
||||||
|
|
||||||
'members' => 'optional list<phid>',
|
'members' => 'optional list<phid>',
|
||||||
|
@ -71,6 +73,22 @@ final class ProjectQueryConduitAPIMethod extends ProjectConduitAPIMethod {
|
||||||
$query->withSlugs($slugs);
|
$query->withSlugs($slugs);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$request->getValue('icons');
|
||||||
|
if ($request->getValue('icons')) {
|
||||||
|
$icons = array();
|
||||||
|
// the internal 'fa-' prefix is a detail hidden from api clients
|
||||||
|
// but needs to pre prepended to the values in the icons array:
|
||||||
|
foreach ($request->getValue('icons') as $value) {
|
||||||
|
$icons[] = 'fa-'.$value;
|
||||||
|
}
|
||||||
|
$query->withIcons($icons);
|
||||||
|
}
|
||||||
|
|
||||||
|
$colors = $request->getValue('colors');
|
||||||
|
if ($colors) {
|
||||||
|
$query->withColors($colors);
|
||||||
|
}
|
||||||
|
|
||||||
$members = $request->getValue('members');
|
$members = $request->getValue('members');
|
||||||
if ($members) {
|
if ($members) {
|
||||||
$query->withMemberPHIDs($members);
|
$query->withMemberPHIDs($members);
|
||||||
|
|
Loading…
Reference in a new issue