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

Add icon, color and profile image to project.query

Summary:
 - The icon CSS tag is transformed through the new function
   PhabricatorProjectIcon::getAPIName($key), which returns
   a name without fa-.

 - Color is a trivial lookup
 - Profile image returns the PHID or null if not available

Test Plan:
 - Create two projects, with different icon and color,
   one with and one without profile image.
 - Request information on both using project.query
Then:
 [ ] Confirm icon and colors are correct for both projects
 [ ] Confirm image PHID is correct
 [ ] Confirm image PHID is null for the project without image

Reviewers: #blessed_reviewers, epriestley

Reviewed By: #blessed_reviewers, epriestley

Subscribers: yuvipanda, Korvin, legoktm, epriestley

Maniphest Tasks: T6501

Differential Revision: https://secure.phabricator.com/D10823
This commit is contained in:
Merlijn van Deen 2014-11-09 11:37:04 -08:00 committed by epriestley
parent 6f971a0fc4
commit ce55bb1d96
2 changed files with 16 additions and 7 deletions

View file

@ -26,14 +26,19 @@ abstract class ProjectConduitAPIMethod extends ConduitAPIMethod {
$project_slugs = $project->getSlugs();
$project_slugs = array_values(mpull($project_slugs, 'getSlug'));
$project_icon = PhabricatorProjectIcon::getAPIName($project->getIcon());
$result[$project->getPHID()] = array(
'id' => $project->getID(),
'phid' => $project->getPHID(),
'name' => $project->getName(),
'members' => $member_phids,
'slugs' => $project_slugs,
'dateCreated' => $project->getDateCreated(),
'dateModified' => $project->getDateModified(),
'id' => $project->getID(),
'phid' => $project->getPHID(),
'name' => $project->getName(),
'profileImagePHID' => $project->getProfileImagePHID(),
'icon' => $project_icon,
'color' => $project->getColor(),
'members' => $member_phids,
'slugs' => $project_slugs,
'dateCreated' => $project->getDateCreated(),
'dateModified' => $project->getDateModified(),
);
}

View file

@ -39,6 +39,10 @@ final class PhabricatorProjectIcon extends Phobject {
return $map[$key];
}
public static function getAPIName($key) {
return substr($key, 3);
}
public static function renderIconForChooser($icon) {
$project_icons = PhabricatorProjectIcon::getIconMap();