@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.) hq.recaptime.dev/wiki/Phorge
phorge phabricator
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge "Profile" and "Account" settings panels

Summary: There are only a total of three options now, merge them into a single panel.

Test Plan:
Set all the settings.

{F49406}

Reviewers: btrahan, chad

Reviewed By: chad

CC: aran

Differential Revision: https://secure.phabricator.com/D6400

+48 -121
-2
src/__phutil_library_map__.php
··· 1496 1496 'PhabricatorSettingsPanelExternalAccounts' => 'applications/settings/panel/PhabricatorSettingsPanelExternalAccounts.php', 1497 1497 'PhabricatorSettingsPanelHomePreferences' => 'applications/settings/panel/PhabricatorSettingsPanelHomePreferences.php', 1498 1498 'PhabricatorSettingsPanelPassword' => 'applications/settings/panel/PhabricatorSettingsPanelPassword.php', 1499 - 'PhabricatorSettingsPanelProfile' => 'applications/settings/panel/PhabricatorSettingsPanelProfile.php', 1500 1499 'PhabricatorSettingsPanelSSHKeys' => 'applications/settings/panel/PhabricatorSettingsPanelSSHKeys.php', 1501 1500 'PhabricatorSettingsPanelSearchPreferences' => 'applications/settings/panel/PhabricatorSettingsPanelSearchPreferences.php', 1502 1501 'PhabricatorSetupCheck' => 'applications/config/check/PhabricatorSetupCheck.php', ··· 3448 3447 'PhabricatorSettingsPanelExternalAccounts' => 'PhabricatorSettingsPanel', 3449 3448 'PhabricatorSettingsPanelHomePreferences' => 'PhabricatorSettingsPanel', 3450 3449 'PhabricatorSettingsPanelPassword' => 'PhabricatorSettingsPanel', 3451 - 'PhabricatorSettingsPanelProfile' => 'PhabricatorSettingsPanel', 3452 3450 'PhabricatorSettingsPanelSSHKeys' => 'PhabricatorSettingsPanel', 3453 3451 'PhabricatorSettingsPanelSearchPreferences' => 'PhabricatorSettingsPanel', 3454 3452 'PhabricatorSetupCheckAPC' => 'PhabricatorSetupCheck',
+48 -7
src/applications/settings/panel/PhabricatorSettingsPanelAccount.php
··· 26 26 $errors[] = pht('The selected timezone is not a valid timezone.'); 27 27 } 28 28 29 + $sex = $request->getStr('sex'); 30 + $sexes = array(PhutilPerson::SEX_MALE, PhutilPerson::SEX_FEMALE); 31 + if (in_array($sex, $sexes)) { 32 + $user->setSex($sex); 33 + } else { 34 + $user->setSex(null); 35 + } 36 + 37 + // Checked in runtime. 38 + $user->setTranslation($request->getStr('translation')); 39 + 29 40 if (!$errors) { 30 41 $user->save(); 31 42 return id(new AphrontRedirectResponse()) ··· 45 56 } 46 57 } else { 47 58 $notice = new AphrontErrorView(); 48 - $notice->setTitle(pht('Form Errors')); 49 59 $notice->setErrors($errors); 50 - $notice = $notice->render(); 51 60 } 52 61 53 62 $timezone_ids = DateTimeZone::listIdentifiers(); 54 63 $timezone_id_map = array_fuse($timezone_ids); 55 64 65 + $sexes = array( 66 + PhutilPerson::SEX_UNKNOWN => pht('Unspecified'), 67 + PhutilPerson::SEX_MALE => pht('Male'), 68 + PhutilPerson::SEX_FEMALE => pht('Female'), 69 + ); 70 + 71 + $translations = array(); 72 + $symbols = id(new PhutilSymbolLoader()) 73 + ->setType('class') 74 + ->setAncestorClass('PhabricatorTranslation') 75 + ->setConcreteOnly(true) 76 + ->selectAndLoadSymbols(); 77 + foreach ($symbols as $symbol) { 78 + $class = $symbol['name']; 79 + $translations[$class] = newv($class, array())->getName(); 80 + } 81 + asort($translations); 82 + $default = PhabricatorEnv::newObjectFromConfig('translation.provider'); 83 + $translations = array( 84 + '' => pht('Server Default (%s)', $default->getName()), 85 + ) + $translations; 86 + 87 + 56 88 $form = new AphrontFormView(); 57 89 $form 58 90 ->setUser($user) 59 - ->appendChild( 60 - id(new AphrontFormStaticControl()) 61 - ->setLabel(pht('Username')) 62 - ->setValue($user->getUsername())) 91 + ->setFlexible(true) 63 92 ->appendChild( 64 93 id(new AphrontFormSelectControl()) 65 94 ->setLabel(pht('Timezone')) ··· 67 96 ->setOptions($timezone_id_map) 68 97 ->setValue($user->getTimezoneIdentifier())) 69 98 ->appendChild( 99 + id(new AphrontFormSelectControl()) 100 + ->setOptions($sexes) 101 + ->setLabel(pht('Sex')) 102 + ->setName('sex') 103 + ->setValue($user->getSex())) 104 + ->appendChild( 105 + id(new AphrontFormSelectControl()) 106 + ->setOptions($translations) 107 + ->setLabel(pht('Translation')) 108 + ->setName('translation') 109 + ->setValue($user->getTranslation())) 110 + ->appendChild( 70 111 id(new AphrontFormSubmitControl()) 71 - ->setValue(pht('Save'))); 112 + ->setValue(pht('Save Account Settings'))); 72 113 73 114 $header = new PhabricatorHeaderView(); 74 115 $header->setHeader(pht('Account Settings'));
-112
src/applications/settings/panel/PhabricatorSettingsPanelProfile.php
··· 1 - <?php 2 - 3 - final class PhabricatorSettingsPanelProfile 4 - extends PhabricatorSettingsPanel { 5 - 6 - public function getPanelKey() { 7 - return 'profile'; 8 - } 9 - 10 - public function getPanelName() { 11 - return pht('Profile'); 12 - } 13 - 14 - public function getPanelGroup() { 15 - return pht('Account Information'); 16 - } 17 - 18 - public function processRequest(AphrontRequest $request) { 19 - $user = $request->getUser(); 20 - 21 - $errors = array(); 22 - if ($request->isFormPost()) { 23 - $sex = $request->getStr('sex'); 24 - $sexes = array(PhutilPerson::SEX_MALE, PhutilPerson::SEX_FEMALE); 25 - if (in_array($sex, $sexes)) { 26 - $user->setSex($sex); 27 - } else { 28 - $user->setSex(null); 29 - } 30 - 31 - // Checked in runtime. 32 - $user->setTranslation($request->getStr('translation')); 33 - 34 - if (!$errors) { 35 - $user->save(); 36 - $response = id(new AphrontRedirectResponse()) 37 - ->setURI($this->getPanelURI('?saved=true')); 38 - return $response; 39 - } 40 - } 41 - 42 - $error_view = null; 43 - if ($errors) { 44 - $error_view = new AphrontErrorView(); 45 - $error_view->setTitle(pht('Form Errors')); 46 - $error_view->setErrors($errors); 47 - } else { 48 - if ($request->getStr('saved')) { 49 - $error_view = new AphrontErrorView(); 50 - $error_view->setSeverity(AphrontErrorView::SEVERITY_NOTICE); 51 - $error_view->setTitle(pht('Changes Saved')); 52 - $error_view->appendChild( 53 - phutil_tag('p', array(), pht('Your changes have been saved.'))); 54 - $error_view = $error_view->render(); 55 - } 56 - } 57 - 58 - $profile_uri = PhabricatorEnv::getURI('/p/'.$user->getUsername().'/'); 59 - 60 - $sexes = array( 61 - PhutilPerson::SEX_UNKNOWN => pht('Unknown'), 62 - PhutilPerson::SEX_MALE => pht('Male'), 63 - PhutilPerson::SEX_FEMALE => pht('Female'), 64 - ); 65 - 66 - $translations = array(); 67 - $symbols = id(new PhutilSymbolLoader()) 68 - ->setType('class') 69 - ->setAncestorClass('PhabricatorTranslation') 70 - ->setConcreteOnly(true) 71 - ->selectAndLoadSymbols(); 72 - foreach ($symbols as $symbol) { 73 - $class = $symbol['name']; 74 - $translations[$class] = newv($class, array())->getName(); 75 - } 76 - asort($translations); 77 - $default = PhabricatorEnv::newObjectFromConfig('translation.provider'); 78 - $translations = array( 79 - '' => pht('Server Default (%s)', $default->getName()), 80 - ) + $translations; 81 - 82 - $form = new AphrontFormView(); 83 - $form 84 - ->setUser($request->getUser()) 85 - ->appendChild( 86 - id(new AphrontFormSelectControl()) 87 - ->setOptions($sexes) 88 - ->setLabel(pht('Sex')) 89 - ->setName('sex') 90 - ->setValue($user->getSex())) 91 - ->appendChild( 92 - id(new AphrontFormSelectControl()) 93 - ->setOptions($translations) 94 - ->setLabel(pht('Translation')) 95 - ->setName('translation') 96 - ->setValue($user->getTranslation())); 97 - 98 - $form->appendChild( 99 - id(new AphrontFormSubmitControl()) 100 - ->setValue(pht('Save'))); 101 - 102 - $header = new PhabricatorHeaderView(); 103 - $header->setHeader(pht('Edit Profile Details')); 104 - 105 - return array( 106 - $error_view, 107 - $header, 108 - $form, 109 - ); 110 - } 111 - 112 - }