1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-19 05:12:41 +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:
Mukunda Modell 2015-06-03 11:43:58 -07:00 committed by epriestley
parent d3a84687ba
commit dfac9d7f52
2 changed files with 39 additions and 0 deletions

View file

@ -14,6 +14,9 @@ final class ProjectCreateConduitAPIMethod extends ProjectConduitAPIMethod {
return array(
'name' => 'required string',
'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)
->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())
->setTransactionType(PhabricatorTransactions::TYPE_EDGE)
->setMetadataValue(

View file

@ -27,6 +27,8 @@ final class ProjectQueryConduitAPIMethod extends ProjectConduitAPIMethod {
'names' => 'optional list<string>',
'phids' => 'optional list<phid>',
'slugs' => 'optional list<string>',
'icons' => 'optional list<string>',
'colors' => 'optional list<string>',
'status' => 'optional '.$status_const,
'members' => 'optional list<phid>',
@ -71,6 +73,22 @@ final class ProjectQueryConduitAPIMethod extends ProjectConduitAPIMethod {
$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');
if ($members) {
$query->withMemberPHIDs($members);