Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F18971354
D18174.id43721.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
4 KB
Referenced Files
None
Subscribers
None
D18174.id43721.diff
View Options
diff --git a/src/__phutil_library_map__.php b/src/__phutil_library_map__.php
--- a/src/__phutil_library_map__.php
+++ b/src/__phutil_library_map__.php
@@ -3653,6 +3653,7 @@
'PhabricatorProjectIconSet' => 'applications/project/icon/PhabricatorProjectIconSet.php',
'PhabricatorProjectIconTransaction' => 'applications/project/xaction/PhabricatorProjectIconTransaction.php',
'PhabricatorProjectIconsConfigType' => 'applications/project/config/PhabricatorProjectIconsConfigType.php',
+ 'PhabricatorProjectImage' => 'applications/project/constants/PhabricatorProjectImage.php',
'PhabricatorProjectImageTransaction' => 'applications/project/xaction/PhabricatorProjectImageTransaction.php',
'PhabricatorProjectInterface' => 'applications/project/interface/PhabricatorProjectInterface.php',
'PhabricatorProjectListController' => 'applications/project/controller/PhabricatorProjectListController.php',
@@ -9117,6 +9118,7 @@
'PhabricatorProjectIconSet' => 'PhabricatorIconSet',
'PhabricatorProjectIconTransaction' => 'PhabricatorProjectTransactionType',
'PhabricatorProjectIconsConfigType' => 'PhabricatorJSONConfigType',
+ 'PhabricatorProjectImage' => 'Phobject',
'PhabricatorProjectImageTransaction' => 'PhabricatorProjectTransactionType',
'PhabricatorProjectListController' => 'PhabricatorProjectController',
'PhabricatorProjectListView' => 'AphrontView',
diff --git a/src/applications/project/constants/PhabricatorProjectImage.php b/src/applications/project/constants/PhabricatorProjectImage.php
new file mode 100644
--- /dev/null
+++ b/src/applications/project/constants/PhabricatorProjectImage.php
@@ -0,0 +1,29 @@
+<?php
+
+final class PhabricatorProjectImage extends Phobject {
+
+ public static function getDefaultImage($icon) {
+ $map = array(
+ 'project' => 'projects/v3/briefcase.png',
+ 'bugs' => 'projects/v3/bug.png',
+ 'timeline' => 'projects/v3/calendar.png',
+ 'infrastructure' => 'projects/v3/cloud.png',
+ 'account' => 'projects/v3/creditcard.png',
+ 'experimental' => 'projects/v3/experimental.png',
+ 'goal' => 'projects/v3/flag.png',
+ 'folder' => 'projects/v3/folder.png',
+ 'policy' => 'projects/v3/lock.png',
+ 'communication' => 'projects/v3/mail.png',
+ 'organization' => 'projects/v3/organization.png',
+ 'group' => 'projects/v3/people.png',
+ 'tag' => 'projects/v3/tag.png',
+ 'cleanup' => 'projects/v3/trash.png',
+ 'release' => 'projects/v3/truck.png',
+ 'umbrella' => 'projects/v3/umbrella.png',
+ // TODO: Need a new milestone image
+ );
+
+ return idx($map, $icon, 'project.png');
+ }
+
+}
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 = PhabricatorProjectImage::getDefaultImage(
+ $project->getIcon());
+ $default_image = PhabricatorFile::loadBuiltin($this->getViewer(), $builtin);
$images = array();
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 = PhabricatorProjectImage::getDefaultImage(
+ $project->getIcon());
+ $file = PhabricatorFile::loadBuiltin($this->getViewer(), $builtin);
}
$project->attachProfileImageFile($file);
}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Nov 16 2025, 11:36 AM (8 w, 3 d ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
9014482
Default Alt Text
D18174.id43721.diff (4 KB)
Attached To
Mode
D18174: Choose default project image by icon
Attached
Detach File
Event Timeline
Log In to Comment