mirror of
https://we.phorge.it/source/phorge.git
synced 2025-02-03 18:38:27 +01:00
eb73c50e87
Summary: Fixes T10319. This looks for custom profile image, then falls back to a generated profile image. Test Plan: Create a new user, log in, and see new profile image. Note this seems to break `bin/lipsum generate user` Reviewers: epriestley Reviewed By: epriestley Subscribers: Korvin Maniphest Tasks: T10319 Differential Revision: https://secure.phabricator.com/D17467
48 lines
1.1 KiB
PHP
48 lines
1.1 KiB
PHP
<?php
|
|
|
|
final class PhabricatorUserProfile extends PhabricatorUserDAO {
|
|
|
|
protected $userPHID;
|
|
protected $title;
|
|
protected $blurb;
|
|
protected $profileImagePHID;
|
|
protected $icon;
|
|
|
|
public static function initializeNewProfile(PhabricatorUser $user) {
|
|
$default_icon = PhabricatorPeopleIconSet::getDefaultIconKey();
|
|
|
|
return id(new self())
|
|
->setUserPHID($user->getPHID())
|
|
->setIcon($default_icon)
|
|
->setTitle('')
|
|
->setBlurb('');
|
|
}
|
|
|
|
protected function getConfiguration() {
|
|
return array(
|
|
self::CONFIG_COLUMN_SCHEMA => array(
|
|
'title' => 'text255',
|
|
'blurb' => 'text',
|
|
'profileImagePHID' => 'phid?',
|
|
'icon' => 'text32',
|
|
),
|
|
self::CONFIG_KEY_SCHEMA => array(
|
|
'userPHID' => array(
|
|
'columns' => array('userPHID'),
|
|
'unique' => true,
|
|
),
|
|
),
|
|
) + parent::getConfiguration();
|
|
}
|
|
|
|
public function getDisplayTitle() {
|
|
$title = $this->getTitle();
|
|
if (strlen($title)) {
|
|
return $title;
|
|
}
|
|
|
|
$icon_key = $this->getIcon();
|
|
return PhabricatorPeopleIconSet::getIconName($icon_key);
|
|
}
|
|
|
|
}
|