mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-22 23:02:42 +01:00
Fix UI for choosing a profile picture when user has no picture
Summary: Currently, we always show "current picture" even if you don't have one. In this case, the first available picture becomes the "current picture". Instead, show "current picture" only if there's actually a current picture to show. Test Plan: {F49875} Reviewers: btrahan, chad Reviewed By: btrahan CC: aran Differential Revision: https://secure.phabricator.com/D6432
This commit is contained in:
parent
620aecb42e
commit
d1e25e3d11
1 changed files with 9 additions and 5 deletions
|
@ -102,6 +102,7 @@ final class PhabricatorPeopleProfilePictureController
|
|||
$images = array();
|
||||
|
||||
$current = $user->getProfileImagePHID();
|
||||
$has_current = false;
|
||||
if ($current) {
|
||||
$files = id(new PhabricatorFileQuery())
|
||||
->setViewer($viewer)
|
||||
|
@ -110,6 +111,7 @@ final class PhabricatorPeopleProfilePictureController
|
|||
if ($files) {
|
||||
$file = head($files);
|
||||
if ($file->isTransformableImage()) {
|
||||
$has_current = true;
|
||||
$images[$current] = array(
|
||||
'uri' => $file->getBestURI(),
|
||||
'tip' => pht('Current Picture'),
|
||||
|
@ -242,15 +244,17 @@ final class PhabricatorPeopleProfilePictureController
|
|||
$buttons[] = $button;
|
||||
}
|
||||
|
||||
$form->appendChild(
|
||||
id(new AphrontFormMarkupControl())
|
||||
->setLabel(pht('Current Picture'))
|
||||
->setValue(array_slice($buttons, 0, 1)));
|
||||
if ($has_current) {
|
||||
$form->appendChild(
|
||||
id(new AphrontFormMarkupControl())
|
||||
->setLabel(pht('Current Picture'))
|
||||
->setValue(array_shift($buttons)));
|
||||
}
|
||||
|
||||
$form->appendChild(
|
||||
id(new AphrontFormMarkupControl())
|
||||
->setLabel(pht('Use Picture'))
|
||||
->setValue(array_slice($buttons, 1)));
|
||||
->setValue($buttons));
|
||||
|
||||
$upload_head = id(new PhabricatorHeaderView())
|
||||
->setHeader(pht('Upload New Picture'));
|
||||
|
|
Loading…
Reference in a new issue