Page MenuHomePhabricator

D18174.id43721.diff
No OneTemporary

D18174.id43721.diff

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

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)

Event Timeline