Changeset View
Changeset View
Standalone View
Standalone View
src/applications/settings/panel/PhabricatorAccountSettingsPanel.php
| Show All 17 Lines | public function isEditableByAdministrators() { | ||||
| return true; | return true; | ||||
| } | } | ||||
| public function processRequest(AphrontRequest $request) { | public function processRequest(AphrontRequest $request) { | ||||
| $viewer = $this->getViewer(); | $viewer = $this->getViewer(); | ||||
| $user = $this->getUser(); | $user = $this->getUser(); | ||||
| $username = $user->getUsername(); | $username = $user->getUsername(); | ||||
| $preferences = $user->loadPreferences(); | |||||
| $errors = array(); | $errors = array(); | ||||
| if ($request->isFormPost()) { | if ($request->isFormPost()) { | ||||
| $sex = $request->getStr('sex'); | $sex = $request->getStr('sex'); | ||||
| $sexes = array(PhutilPerson::SEX_MALE, PhutilPerson::SEX_FEMALE); | $sexes = array(PhutilPerson::SEX_MALE, PhutilPerson::SEX_FEMALE); | ||||
| if (in_array($sex, $sexes)) { | if (in_array($sex, $sexes)) { | ||||
| $user->setSex($sex); | $new_value = $sex; | ||||
| } else { | } else { | ||||
| $user->setSex(null); | $new_value = null; | ||||
| } | } | ||||
| // Checked in runtime. | $preferences->setPreference( | ||||
| $user->setTranslation($request->getStr('translation')); | PhabricatorPronounSetting::SETTINGKEY, | ||||
| $new_value); | |||||
| $preferences->setPreference( | |||||
| PhabricatorTranslationSetting::SETTINGKEY, | |||||
| $request->getStr('translation')); | |||||
| if (!$errors) { | if (!$errors) { | ||||
| $user->save(); | $preferences->save(); | ||||
| return id(new AphrontRedirectResponse()) | return id(new AphrontRedirectResponse()) | ||||
| ->setURI($this->getPanelURI('?saved=true')); | ->setURI($this->getPanelURI('?saved=true')); | ||||
| } | } | ||||
| } | } | ||||
| $label_unknown = pht('%s updated their profile', $username); | $label_unknown = pht('%s updated their profile', $username); | ||||
| $label_her = pht('%s updated her profile', $username); | $label_her = pht('%s updated her profile', $username); | ||||
| $label_his = pht('%s updated his profile', $username); | $label_his = pht('%s updated his profile', $username); | ||||
| ▲ Show 20 Lines • Show All 123 Lines • Show Last 20 Lines | |||||