Robustify profile image controls ever so slightly
Summary: show project profile image on pertinent edit page. also add a "Use Default Image" checkbox for both project and user profiles. Also added a function for projects to get the profile picture to prevent some copy + paste action. Test Plan: set my user profile and project profile image. clicked "Use Default Image" and got the default image back. Reviewers: epriestley, floatinglomas Reviewed By: floatinglomas CC: aran, Korvin Maniphest Tasks: T1307 Differential Revision: https://secure.phabricator.com/D2852
This commit is contained in:
@@ -33,11 +33,12 @@ final class PhabricatorProjectProfileEditController
|
||||
return new Aphront404Response();
|
||||
}
|
||||
$profile = $project->loadProfile();
|
||||
|
||||
if (empty($profile)) {
|
||||
$profile = new PhabricatorProjectProfile();
|
||||
}
|
||||
|
||||
$img_src = $profile->loadProfileImageURI();
|
||||
|
||||
if ($project->getSubprojectPHIDs()) {
|
||||
$phids = $project->getSubprojectPHIDs();
|
||||
$handles = id(new PhabricatorObjectHandleData($phids))
|
||||
@@ -93,7 +94,10 @@ final class PhabricatorProjectProfileEditController
|
||||
$e_name = null;
|
||||
}
|
||||
|
||||
if (!empty($_FILES['image'])) {
|
||||
$default_image = $request->getExists('default_image');
|
||||
if ($default_image) {
|
||||
$profile->setProfileImagePHID(null);
|
||||
} else if (!empty($_FILES['image'])) {
|
||||
$err = idx($_FILES['image'], 'error');
|
||||
if ($err != UPLOAD_ERR_NO_FILE) {
|
||||
$file = PhabricatorFile::newFromPHPUpload(
|
||||
@@ -252,7 +256,16 @@ final class PhabricatorProjectProfileEditController
|
||||
->setName('set_subprojects')
|
||||
->setValue($subprojects))
|
||||
->appendChild(
|
||||
id(new AphrontFormFileControl())
|
||||
id(new AphrontFormMarkupControl())
|
||||
->setLabel('Profile Image')
|
||||
->setValue(
|
||||
phutil_render_tag(
|
||||
'img',
|
||||
array(
|
||||
'src' => $img_src,
|
||||
))))
|
||||
->appendChild(
|
||||
id(new AphrontFormImageControl())
|
||||
->setLabel('Change Image')
|
||||
->setName('image')
|
||||
->setError($e_image)
|
||||
|
||||
Reference in New Issue
Block a user