1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-10 00:42:41 +01:00

Don't throw when a user saves account settings without changing their profile

picture.

Summary:
Going to Settings -> Account and hitting "Save" without selecting
a file in the file dialog currently throws.

Test Plan:
Went to Settings -> Account and hit "Save" without making changes.
No exception. Then uploaded a picture normally.

Differential Revision: 30
Reviewed By: tomo
Reviewers: tomo
This commit is contained in:
epriestley 2011-02-09 22:35:00 -08:00
parent e8e185ceb3
commit 03b88d1da3

View file

@ -73,8 +73,11 @@ class PhabricatorUserSettingsController extends PhabricatorPeopleController {
->setURI('/settings/page/arcanist/?regenerated=true');
case 'account':
if (!empty($_FILES['profile'])) {
$file = PhabricatorFile::newFromPHPUpload($_FILES['profile']);
$user->setProfileImagePHID($file->getPHID());
$err = idx($_FILES['profile'], 'error');
if ($err != UPLOAD_ERR_NO_FILE) {
$file = PhabricatorFile::newFromPHPUpload($_FILES['profile']);
$user->setProfileImagePHID($file->getPHID());
}
}
$user->save();