mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-26 08:42:41 +01:00
Add sex
Summary: We will need it for intl. I've put it to User instead of UserProfile to be easier accessible. Test Plan: Apply SQL patch. Change sex to Male. Change sex to Unknown. Reviewers: epriestley Reviewed By: epriestley CC: aran, Koolvin Maniphest Tasks: T1139 Differential Revision: https://secure.phabricator.com/D2287
This commit is contained in:
parent
9b8eaa5fd5
commit
549a86cd96
4 changed files with 23 additions and 0 deletions
2
resources/sql/patches/136.sex.sql
Normal file
2
resources/sql/patches/136.sex.sql
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
ALTER TABLE `phabricator_user`.`user`
|
||||||
|
ADD `sex` char(1) COLLATE utf8_bin AFTER `email`;
|
|
@ -40,6 +40,13 @@ final class PhabricatorUserProfileSettingsPanelController
|
||||||
$profile->setTitle($request->getStr('title'));
|
$profile->setTitle($request->getStr('title'));
|
||||||
$profile->setBlurb($request->getStr('blurb'));
|
$profile->setBlurb($request->getStr('blurb'));
|
||||||
|
|
||||||
|
$sex = $request->getStr('sex');
|
||||||
|
if (in_array($sex, array('m', 'f'))) {
|
||||||
|
$user->setSex($sex);
|
||||||
|
} else {
|
||||||
|
$user->setSex(null);
|
||||||
|
}
|
||||||
|
|
||||||
if (!empty($_FILES['image'])) {
|
if (!empty($_FILES['image'])) {
|
||||||
$err = idx($_FILES['image'], 'error');
|
$err = idx($_FILES['image'], 'error');
|
||||||
if ($err != UPLOAD_ERR_NO_FILE) {
|
if ($err != UPLOAD_ERR_NO_FILE) {
|
||||||
|
@ -110,6 +117,12 @@ final class PhabricatorUserProfileSettingsPanelController
|
||||||
}
|
}
|
||||||
$profile_uri = PhabricatorEnv::getURI('/p/'.$user->getUsername().'/');
|
$profile_uri = PhabricatorEnv::getURI('/p/'.$user->getUsername().'/');
|
||||||
|
|
||||||
|
$sexes = array(
|
||||||
|
'' => 'Unknown',
|
||||||
|
'm' => 'Male',
|
||||||
|
'f' => 'Female',
|
||||||
|
);
|
||||||
|
|
||||||
$form = new AphrontFormView();
|
$form = new AphrontFormView();
|
||||||
$form
|
$form
|
||||||
->setUser($request->getUser())
|
->setUser($request->getUser())
|
||||||
|
@ -121,6 +134,12 @@ final class PhabricatorUserProfileSettingsPanelController
|
||||||
->setName('title')
|
->setName('title')
|
||||||
->setValue($profile->getTitle())
|
->setValue($profile->getTitle())
|
||||||
->setCaption('Serious business title.'))
|
->setCaption('Serious business title.'))
|
||||||
|
->appendChild(
|
||||||
|
id(new AphrontFormSelectControl())
|
||||||
|
->setOptions($sexes)
|
||||||
|
->setLabel('Sex')
|
||||||
|
->setName('sex')
|
||||||
|
->setValue($user->getSex()))
|
||||||
->appendChild(
|
->appendChild(
|
||||||
id(new AphrontFormMarkupControl())
|
id(new AphrontFormMarkupControl())
|
||||||
->setLabel('Profile URI')
|
->setLabel('Profile URI')
|
||||||
|
|
|
@ -15,6 +15,7 @@ phutil_require_module('phabricator', 'infrastructure/env');
|
||||||
phutil_require_module('phabricator', 'view/form/base');
|
phutil_require_module('phabricator', 'view/form/base');
|
||||||
phutil_require_module('phabricator', 'view/form/control/file');
|
phutil_require_module('phabricator', 'view/form/control/file');
|
||||||
phutil_require_module('phabricator', 'view/form/control/markup');
|
phutil_require_module('phabricator', 'view/form/control/markup');
|
||||||
|
phutil_require_module('phabricator', 'view/form/control/select');
|
||||||
phutil_require_module('phabricator', 'view/form/control/submit');
|
phutil_require_module('phabricator', 'view/form/control/submit');
|
||||||
phutil_require_module('phabricator', 'view/form/control/text');
|
phutil_require_module('phabricator', 'view/form/control/text');
|
||||||
phutil_require_module('phabricator', 'view/form/control/textarea');
|
phutil_require_module('phabricator', 'view/form/control/textarea');
|
||||||
|
|
|
@ -25,6 +25,7 @@ final class PhabricatorUser extends PhabricatorUserDAO {
|
||||||
protected $userName;
|
protected $userName;
|
||||||
protected $realName;
|
protected $realName;
|
||||||
protected $email;
|
protected $email;
|
||||||
|
protected $sex;
|
||||||
protected $passwordSalt;
|
protected $passwordSalt;
|
||||||
protected $passwordHash;
|
protected $passwordHash;
|
||||||
protected $profileImagePHID;
|
protected $profileImagePHID;
|
||||||
|
|
Loading…
Reference in a new issue