Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F15390649
D18174.id43747.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
7 KB
Referenced Files
None
Subscribers
None
D18174.id43747.diff
View Options
diff --git a/src/applications/project/controller/PhabricatorProjectEditPictureController.php b/src/applications/project/controller/PhabricatorProjectEditPictureController.php
--- a/src/applications/project/controller/PhabricatorProjectEditPictureController.php
+++ b/src/applications/project/controller/PhabricatorProjectEditPictureController.php
@@ -98,7 +98,9 @@
$form = id(new PHUIFormLayoutView())
->setUser($viewer);
- $default_image = PhabricatorFile::loadBuiltin($viewer, 'project.png');
+ $builtin = PhabricatorProjectIconSet::getIconImage(
+ $project->getIcon());
+ $default_image = PhabricatorFile::loadBuiltin($this->getViewer(), $builtin);
$images = array();
diff --git a/src/applications/project/editor/PhabricatorProjectTransactionEditor.php b/src/applications/project/editor/PhabricatorProjectTransactionEditor.php
--- a/src/applications/project/editor/PhabricatorProjectTransactionEditor.php
+++ b/src/applications/project/editor/PhabricatorProjectTransactionEditor.php
@@ -296,10 +296,6 @@
}
}
- if ($this->getIsNewObject()) {
- $this->setDefaultProfilePicture($object);
- }
-
// TODO: We should dump an informational transaction onto the parent
// project to show that we created the sub-thing.
@@ -457,34 +453,6 @@
return $results;
}
- private function setDefaultProfilePicture(PhabricatorProject $project) {
- if ($project->isMilestone()) {
- return;
- }
-
- $compose_color = $project->getDisplayIconComposeColor();
- $compose_icon = $project->getDisplayIconComposeIcon();
-
- $builtin = id(new PhabricatorFilesComposeIconBuiltinFile())
- ->setColor($compose_color)
- ->setIcon($compose_icon);
-
- $data = $builtin->loadBuiltinFileData();
-
- $file = PhabricatorFile::newFromFileData(
- $data,
- array(
- 'name' => $builtin->getBuiltinDisplayName(),
- 'profile' => true,
- 'canCDN' => true,
- ));
-
- $project
- ->setProfileImagePHID($file->getPHID())
- ->save();
- }
-
-
protected function shouldApplyHeraldRules(
PhabricatorLiskDAO $object,
array $xactions) {
diff --git a/src/applications/project/icon/PhabricatorProjectIconSet.php b/src/applications/project/icon/PhabricatorProjectIconSet.php
--- a/src/applications/project/icon/PhabricatorProjectIconSet.php
+++ b/src/applications/project/icon/PhabricatorProjectIconSet.php
@@ -18,87 +18,104 @@
'icon' => 'fa-briefcase',
'name' => pht('Project'),
'default' => true,
+ 'image' => 'projects/v3/briefcase.png',
),
array(
'key' => 'tag',
'icon' => 'fa-tags',
'name' => pht('Tag'),
+ 'image' => 'projects/v3/tag.png',
),
array(
'key' => 'policy',
'icon' => 'fa-lock',
'name' => pht('Policy'),
+ 'image' => 'projects/v3/lock.png',
),
array(
'key' => 'group',
'icon' => 'fa-users',
'name' => pht('Group'),
+ 'image' => 'projects/v3/people.png',
),
array(
'key' => 'folder',
'icon' => 'fa-folder',
'name' => pht('Folder'),
+ 'image' => 'projects/v3/folder.png',
),
array(
'key' => 'timeline',
'icon' => 'fa-calendar',
'name' => pht('Timeline'),
+ 'image' => 'projects/v3/calendar.png',
),
array(
'key' => 'goal',
'icon' => 'fa-flag-checkered',
'name' => pht('Goal'),
+ 'image' => 'projects/v3/flag.png',
),
array(
'key' => 'release',
'icon' => 'fa-truck',
'name' => pht('Release'),
+ 'image' => 'projects/v3/truck.png',
),
array(
'key' => 'bugs',
'icon' => 'fa-bug',
'name' => pht('Bugs'),
+ 'image' => 'projects/v3/bug.png',
),
array(
'key' => 'cleanup',
'icon' => 'fa-trash-o',
'name' => pht('Cleanup'),
+ 'image' => 'projects/v3/trash.png',
),
array(
'key' => 'umbrella',
'icon' => 'fa-umbrella',
'name' => pht('Umbrella'),
+ 'image' => 'projects/v3/umbrella.png',
),
array(
'key' => 'communication',
'icon' => 'fa-envelope',
'name' => pht('Communication'),
+ 'image' => 'projects/v3/mail.png',
),
array(
'key' => 'organization',
'icon' => 'fa-building',
'name' => pht('Organization'),
+ 'image' => 'projects/v3/organization.png',
),
array(
'key' => 'infrastructure',
'icon' => 'fa-cloud',
'name' => pht('Infrastructure'),
+ 'image' => 'projects/v3/cloud.png',
),
array(
'key' => 'account',
'icon' => 'fa-credit-card',
'name' => pht('Account'),
+ 'image' => 'projects/v3/creditcard.png',
),
array(
'key' => 'experimental',
'icon' => 'fa-flask',
'name' => pht('Experimental'),
+ 'image' => 'projects/v3/experimental.png',
),
array(
'key' => 'milestone',
'icon' => 'fa-map-marker',
'name' => pht('Milestone'),
'special' => self::SPECIAL_MILESTONE,
+ 'image' => 'projects/v3/project.png',
),
);
}
@@ -149,6 +166,11 @@
return idx($spec, 'name', null);
}
+ public static function getIconImage($key) {
+ $spec = self::getIconSpec($key);
+ return idx($spec, 'image', null);
+ }
+
private static function getIconSpec($key) {
$icons = self::getIconSpecifications();
foreach ($icons as $icon) {
@@ -190,6 +212,7 @@
'key' => 'string',
'name' => 'string',
'icon' => 'string',
+ 'image' => 'optional string',
'special' => 'optional string',
'disabled' => 'optional bool',
'default' => 'optional bool',
@@ -239,6 +262,18 @@
$is_disabled = idx($value, 'disabled');
+ if (idx($value, 'image')) {
+ $builtin = idx($value, 'image');
+ $file = PhabricatorFile::loadBuiltin($this->getViewer(), $builtin);
+ if (!$file) {
+ throw new Exception(
+ pht(
+ 'The project image specified as the default image for ("%s") '.
+ 'was not found in "resources/builtin."',
+ $key));
+ }
+ }
+
if (idx($value, 'default')) {
if ($default === null) {
if ($is_disabled) {
diff --git a/src/applications/project/query/PhabricatorProjectQuery.php b/src/applications/project/query/PhabricatorProjectQuery.php
--- a/src/applications/project/query/PhabricatorProjectQuery.php
+++ b/src/applications/project/query/PhabricatorProjectQuery.php
@@ -358,8 +358,6 @@
protected function didFilterPage(array $projects) {
if ($this->needImages) {
- $default = null;
-
$file_phids = mpull($projects, 'getProfileImagePHID');
$file_phids = array_filter($file_phids);
if ($file_phids) {
@@ -376,12 +374,9 @@
foreach ($projects as $project) {
$file = idx($files, $project->getProfileImagePHID());
if (!$file) {
- if (!$default) {
- $default = PhabricatorFile::loadBuiltin(
- $this->getViewer(),
- 'project.png');
- }
- $file = $default;
+ $builtin = PhabricatorProjectIconSet::getIconImage(
+ $project->getIcon());
+ $file = PhabricatorFile::loadBuiltin($this->getViewer(), $builtin);
}
$project->attachProfileImageFile($file);
}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sun, Mar 16, 6:24 AM (3 w, 3 d ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
7706379
Default Alt Text
D18174.id43747.diff (7 KB)
Attached To
Mode
D18174: Choose default project image by icon
Attached
Detach File
Event Timeline
Log In to Comment