Modularize Conpherence notification preferences
Summary: Ref T4103. This is a weird standalone setting that I didn't clean up earlier. Also fix an issue with the PronounSetting and the Editor not interacting properly. Test Plan: Edited using new EditEngine UI. Reviewers: chad Reviewed By: chad Maniphest Tasks: T4103 Differential Revision: https://secure.phabricator.com/D16014
This commit is contained in:
		| @@ -2145,6 +2145,7 @@ phutil_register_library_map(array( | ||||
|     'PhabricatorConfigVersionsModule' => 'applications/config/module/PhabricatorConfigVersionsModule.php', | ||||
|     'PhabricatorConfigWelcomeController' => 'applications/config/controller/PhabricatorConfigWelcomeController.php', | ||||
|     'PhabricatorConpherenceApplication' => 'applications/conpherence/application/PhabricatorConpherenceApplication.php', | ||||
|     'PhabricatorConpherenceNotificationsSetting' => 'applications/settings/setting/PhabricatorConpherenceNotificationsSetting.php', | ||||
|     'PhabricatorConpherencePreferencesSettingsPanel' => 'applications/settings/panel/PhabricatorConpherencePreferencesSettingsPanel.php', | ||||
|     'PhabricatorConpherenceThreadPHIDType' => 'applications/conpherence/phid/PhabricatorConpherenceThreadPHIDType.php', | ||||
|     'PhabricatorConsoleApplication' => 'applications/console/application/PhabricatorConsoleApplication.php', | ||||
| @@ -6676,6 +6677,7 @@ phutil_register_library_map(array( | ||||
|     'PhabricatorConfigVersionsModule' => 'PhabricatorConfigModule', | ||||
|     'PhabricatorConfigWelcomeController' => 'PhabricatorConfigController', | ||||
|     'PhabricatorConpherenceApplication' => 'PhabricatorApplication', | ||||
|     'PhabricatorConpherenceNotificationsSetting' => 'PhabricatorSelectSetting', | ||||
|     'PhabricatorConpherencePreferencesSettingsPanel' => 'PhabricatorSettingsPanel', | ||||
|     'PhabricatorConpherenceThreadPHIDType' => 'PhabricatorPHIDType', | ||||
|     'PhabricatorConsoleApplication' => 'PhabricatorApplication', | ||||
|   | ||||
| @@ -99,6 +99,12 @@ final class PhabricatorUserPreferencesEditor | ||||
|     $actor = $this->getActor(); | ||||
|     $settings = PhabricatorSetting::getAllEnabledSettings($actor); | ||||
|  | ||||
|     foreach ($settings as $key => $setting) { | ||||
|       $setting = clone $setting; | ||||
|       $setting->setViewer($actor); | ||||
|       $settings[$key] = $setting; | ||||
|     } | ||||
|  | ||||
|     switch ($type) { | ||||
|       case PhabricatorUserPreferencesTransaction::TYPE_SETTING: | ||||
|         foreach ($xactions as $xaction) { | ||||
|   | ||||
| @@ -0,0 +1,31 @@ | ||||
| <?php | ||||
|  | ||||
| final class PhabricatorConpherenceNotificationsSetting | ||||
|   extends PhabricatorSelectSetting { | ||||
|  | ||||
|   const SETTINGKEY = 'conph-notifications'; | ||||
|  | ||||
|   const VALUE_CONPHERENCE_EMAIL = '0'; | ||||
|   const VALUE_CONPHERENCE_NOTIFY = '1'; | ||||
|  | ||||
|   public function getSettingName() { | ||||
|     return pht('Conpherence Notifications'); | ||||
|   } | ||||
|  | ||||
|   protected function getControlInstructions() { | ||||
|     return pht( | ||||
|       'Choose the default notification behavior for Conpherence rooms.'); | ||||
|   } | ||||
|  | ||||
|   public function getSettingDefaultValue() { | ||||
|     return self::VALUE_CONPHERENCE_EMAIL; | ||||
|   } | ||||
|  | ||||
|   protected function getSelectOptions() { | ||||
|     return array( | ||||
|       self::VALUE_CONPHERENCE_EMAIL => pht('Send Email'), | ||||
|       self::VALUE_CONPHERENCE_NOTIFY => pht('Send Notifications'), | ||||
|     ); | ||||
|   } | ||||
|  | ||||
| } | ||||
		Reference in New Issue
	
	Block a user
	 epriestley
					epriestley