@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.

Modularize all the mail preferences

Summary:
Ref T4103. This isn't completely perfect but should let us move forward without also expanding scope into "too much mail".

I split the existing "Mail Preferences" into two panels: a "Mail Delivery" panel for the EditEngine settings, and a "2000000 dropdowns" panel for the two million dropdowns. This one retains the old code more or less unmodified.

Test Plan:
- Ran unit tests, which cover most of this stuff.
- Grepped for all removed constants.
- Ran migrations, inspected database results.
- Changed settings in both modified panels.
- This covers a lot of ground, but anything I missed will hopefully be fairly obvious.

Reviewers: chad

Reviewed By: chad

Maniphest Tasks: T4103

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

+258 -172
+47
resources/sql/autopatches/20160604.user.01.stringmailprefs.php
··· 1 + <?php 2 + 3 + 4 + $table = new PhabricatorUserPreferences(); 5 + $conn_w = $table->establishConnection('w'); 6 + 7 + // Convert "Mail Format", "Re Prefix" and "Vary Subjects" mail settings to 8 + // string constants to avoid weird stuff where we store "true" and "false" as 9 + // strings in the database. 10 + 11 + // Each of these keys will be converted to the first value if present and 12 + // truthy, or the second value if present and falsey. 13 + $remap = array( 14 + 'html-emails' => array('html', 'text'), 15 + 're-prefix' => array('re', 'none'), 16 + 'vary-subject' => array('vary', 'static'), 17 + ); 18 + 19 + foreach (new LiskMigrationIterator($table) as $row) { 20 + $dict = $row->getPreferences(); 21 + 22 + $should_update = false; 23 + foreach ($remap as $key => $value) { 24 + if (isset($dict[$key])) { 25 + if ($dict[$key]) { 26 + $dict[$key] = $value[0]; 27 + } else { 28 + $dict[$key] = $value[1]; 29 + } 30 + $should_update = true; 31 + } 32 + } 33 + 34 + if (!$should_update) { 35 + continue; 36 + } 37 + 38 + queryfx( 39 + $conn_w, 40 + 'UPDATE %T SET preferences = %s WHERE id = %d', 41 + $table->getTableName(), 42 + phutil_json_encode($dict), 43 + $row->getID()); 44 + } 45 + 46 + $prefs_key = PhabricatorUserPreferencesCacheType::KEY_PREFERENCES; 47 + PhabricatorUserCache::clearCacheForAllUsers($prefs_key);
+4
src/__phutil_library_map__.php
··· 2389 2389 'PhabricatorElasticSearchSetupCheck' => 'applications/config/check/PhabricatorElasticSearchSetupCheck.php', 2390 2390 'PhabricatorEmailAddressesSettingsPanel' => 'applications/settings/panel/PhabricatorEmailAddressesSettingsPanel.php', 2391 2391 'PhabricatorEmailContentSource' => 'applications/metamta/contentsource/PhabricatorEmailContentSource.php', 2392 + 'PhabricatorEmailDeliverySettingsPanel' => 'applications/settings/panel/PhabricatorEmailDeliverySettingsPanel.php', 2392 2393 'PhabricatorEmailFormatSetting' => 'applications/settings/setting/PhabricatorEmailFormatSetting.php', 2393 2394 'PhabricatorEmailFormatSettingsPanel' => 'applications/settings/panel/PhabricatorEmailFormatSettingsPanel.php', 2394 2395 'PhabricatorEmailLoginController' => 'applications/auth/controller/PhabricatorEmailLoginController.php', ··· 2396 2397 'PhabricatorEmailPreferencesSettingsPanel' => 'applications/settings/panel/PhabricatorEmailPreferencesSettingsPanel.php', 2397 2398 'PhabricatorEmailRePrefixSetting' => 'applications/settings/setting/PhabricatorEmailRePrefixSetting.php', 2398 2399 'PhabricatorEmailSelfActionsSetting' => 'applications/settings/setting/PhabricatorEmailSelfActionsSetting.php', 2400 + 'PhabricatorEmailTagsSetting' => 'applications/settings/setting/PhabricatorEmailTagsSetting.php', 2399 2401 'PhabricatorEmailVarySubjectsSetting' => 'applications/settings/setting/PhabricatorEmailVarySubjectsSetting.php', 2400 2402 'PhabricatorEmailVerificationController' => 'applications/auth/controller/PhabricatorEmailVerificationController.php', 2401 2403 'PhabricatorEmbedFileRemarkupRule' => 'applications/files/markup/PhabricatorEmbedFileRemarkupRule.php', ··· 6976 6978 'PhabricatorElasticSearchSetupCheck' => 'PhabricatorSetupCheck', 6977 6979 'PhabricatorEmailAddressesSettingsPanel' => 'PhabricatorSettingsPanel', 6978 6980 'PhabricatorEmailContentSource' => 'PhabricatorContentSource', 6981 + 'PhabricatorEmailDeliverySettingsPanel' => 'PhabricatorEditEngineSettingsPanel', 6979 6982 'PhabricatorEmailFormatSetting' => 'PhabricatorSelectSetting', 6980 6983 'PhabricatorEmailFormatSettingsPanel' => 'PhabricatorEditEngineSettingsPanel', 6981 6984 'PhabricatorEmailLoginController' => 'PhabricatorAuthController', ··· 6983 6986 'PhabricatorEmailPreferencesSettingsPanel' => 'PhabricatorSettingsPanel', 6984 6987 'PhabricatorEmailRePrefixSetting' => 'PhabricatorSelectSetting', 6985 6988 'PhabricatorEmailSelfActionsSetting' => 'PhabricatorSelectSetting', 6989 + 'PhabricatorEmailTagsSetting' => 'PhabricatorInternalSetting', 6986 6990 'PhabricatorEmailVarySubjectsSetting' => 'PhabricatorSelectSetting', 6987 6991 'PhabricatorEmailVerificationController' => 'PhabricatorAuthController', 6988 6992 'PhabricatorEmbedFileRemarkupRule' => 'PhabricatorObjectRemarkupRule',
+4 -5
src/applications/feed/PhabricatorFeedStoryPublisher.php
··· 214 214 $all_prefs = mpull($all_prefs, null, 'getUserPHID'); 215 215 } 216 216 217 - $pref_default = PhabricatorUserPreferences::MAILTAG_PREFERENCE_EMAIL; 218 - $pref_ignore = PhabricatorUserPreferences::MAILTAG_PREFERENCE_IGNORE; 217 + $pref_default = PhabricatorEmailTagsSetting::VALUE_EMAIL; 218 + $pref_ignore = PhabricatorEmailTagsSetting::VALUE_IGNORE; 219 219 220 220 $keep = array(); 221 221 foreach ($phids as $phid) { ··· 224 224 } 225 225 226 226 if ($tags && isset($all_prefs[$phid])) { 227 - $mailtags = $all_prefs[$phid]->getPreference( 228 - PhabricatorUserPreferences::PREFERENCE_MAILTAGS, 229 - array()); 227 + $mailtags = $all_prefs[$phid]->getSettingValue( 228 + PhabricatorEmailTagsSetting::SETTINGKEY); 230 229 231 230 $notify = false; 232 231 foreach ($tags as $tag) {
+81 -61
src/applications/metamta/storage/PhabricatorMetaMTAMail.php
··· 435 435 $add_cc = array(); 436 436 $add_to = array(); 437 437 438 - // Only try to use preferences if everything is multiplexed, so we 439 - // get consistent behavior. 440 - $use_prefs = self::shouldMultiplexAllMail(); 441 - 442 - $prefs = null; 443 - if ($use_prefs) { 444 - 445 - // If multiplexing is enabled, some recipients will be in "Cc" 446 - // rather than "To". We'll move them to "To" later (or supply a 447 - // dummy "To") but need to look for the recipient in either the 448 - // "To" or "Cc" fields here. 449 - $target_phid = head(idx($params, 'to', array())); 450 - if (!$target_phid) { 451 - $target_phid = head(idx($params, 'cc', array())); 452 - } 453 - 454 - if ($target_phid) { 455 - $user = id(new PhabricatorUser())->loadOneWhere( 456 - 'phid = %s', 457 - $target_phid); 458 - if ($user) { 459 - $prefs = $user->loadPreferences(); 460 - } 461 - } 438 + // If multiplexing is enabled, some recipients will be in "Cc" 439 + // rather than "To". We'll move them to "To" later (or supply a 440 + // dummy "To") but need to look for the recipient in either the 441 + // "To" or "Cc" fields here. 442 + $target_phid = head(idx($params, 'to', array())); 443 + if (!$target_phid) { 444 + $target_phid = head(idx($params, 'cc', array())); 462 445 } 463 446 447 + $preferences = $this->loadPreferences($target_phid); 448 + 464 449 foreach ($params as $key => $value) { 465 450 switch ($key) { 466 451 case 'raw-from': ··· 526 511 $subject = array(); 527 512 528 513 if ($is_threaded) { 529 - $add_re = PhabricatorEnv::getEnvConfig('metamta.re-prefix'); 530 - 531 - if ($prefs) { 532 - $add_re = $prefs->getPreference( 533 - PhabricatorUserPreferences::PREFERENCE_RE_PREFIX, 534 - $add_re); 535 - } 536 - 537 - if ($add_re) { 514 + if ($this->shouldAddRePrefix($preferences)) { 538 515 $subject[] = 'Re:'; 539 516 } 540 517 } ··· 543 520 544 521 $vary_prefix = idx($params, 'vary-subject-prefix'); 545 522 if ($vary_prefix != '') { 546 - $use_subject = PhabricatorEnv::getEnvConfig( 547 - 'metamta.vary-subjects'); 548 - 549 - if ($prefs) { 550 - $use_subject = $prefs->getPreference( 551 - PhabricatorUserPreferences::PREFERENCE_VARY_SUBJECT, 552 - $use_subject); 553 - } 554 - 555 - if ($use_subject) { 523 + if ($this->shouldVarySubject($preferences)) { 556 524 $subject[] = $vary_prefix; 557 525 } 558 526 } ··· 607 575 } 608 576 $mailer->setBody($body); 609 577 610 - $html_emails = true; 611 - if ($use_prefs && $prefs) { 612 - $html_emails = $prefs->getPreference( 613 - PhabricatorUserPreferences::PREFERENCE_HTML_EMAILS, 614 - $html_emails); 615 - } 616 - 578 + $html_emails = $this->shouldSendHTML($preferences); 617 579 if ($html_emails && isset($params['html-body'])) { 618 580 $mailer->setHTMLBody($params['html-body']); 619 581 } ··· 900 862 $from_user = id(new PhabricatorPeopleQuery()) 901 863 ->setViewer($viewer) 902 864 ->withPHIDs(array($from_phid)) 865 + ->needUserSettings(true) 903 866 ->execute(); 904 867 $from_user = head($from_user); 905 868 if ($from_user) { 906 - $pref_key = PhabricatorUserPreferences::PREFERENCE_NO_SELF_MAIL; 907 - $exclude_self = $from_user 908 - ->loadPreferences() 909 - ->getPreference($pref_key); 869 + $pref_key = PhabricatorEmailSelfActionsSetting::SETTINGKEY; 870 + $exclude_self = $from_user->getUserSetting($pref_key); 910 871 if ($exclude_self) { 911 872 $from_actor->setUndeliverable(PhabricatorMetaMTAActor::REASON_SELF); 912 873 } ··· 919 880 ->execute(); 920 881 $all_prefs = mpull($all_prefs, null, 'getUserPHID'); 921 882 922 - $value_email = PhabricatorUserPreferences::MAILTAG_PREFERENCE_EMAIL; 883 + $value_email = PhabricatorEmailTagsSetting::VALUE_EMAIL; 923 884 924 885 // Exclude all recipients who have set preferences to not receive this type 925 886 // of email (for example, a user who says they don't want emails about task ··· 927 888 $tags = $this->getParam('mailtags'); 928 889 if ($tags) { 929 890 foreach ($all_prefs as $phid => $prefs) { 930 - $user_mailtags = $prefs->getPreference( 931 - PhabricatorUserPreferences::PREFERENCE_MAILTAGS, 932 - array()); 891 + $user_mailtags = $prefs->getSettingValue( 892 + PhabricatorEmailTagsSetting::SETTINGKEY); 933 893 934 894 // The user must have elected to receive mail for at least one 935 895 // of the mailtags. ··· 982 942 // Exclude recipients who don't want any mail. This rule is very strong 983 943 // and runs last. 984 944 foreach ($all_prefs as $phid => $prefs) { 985 - $exclude = $prefs->getPreference( 986 - PhabricatorUserPreferences::PREFERENCE_NO_MAIL, 987 - false); 945 + $exclude = $prefs->getSettingValue( 946 + PhabricatorEmailNotificationsSetting::SETTINGKEY); 988 947 if ($exclude) { 989 948 $actors[$phid]->setUndeliverable( 990 949 PhabricatorMetaMTAActor::REASON_MAIL_DISABLED); ··· 1140 1099 } 1141 1100 1142 1101 return $this->routingMap; 1102 + } 1103 + 1104 + /* -( Preferences )-------------------------------------------------------- */ 1105 + 1106 + 1107 + private function loadPreferences($target_phid) { 1108 + if (!self::shouldMultiplexAllMail()) { 1109 + $target_phid = null; 1110 + } 1111 + 1112 + if ($target_phid) { 1113 + $preferences = id(new PhabricatorUserPreferencesQuery()) 1114 + ->setViewer(PhabricatorUser::getOmnipotentUser()) 1115 + ->withUserPHIDs(array($target_phid)) 1116 + ->executeOne(); 1117 + } else { 1118 + $preferences = null; 1119 + } 1120 + 1121 + // TODO: Here, we would load global preferences once they exist. 1122 + 1123 + if (!$preferences) { 1124 + // If we haven't found suitable preferences yet, return an empty object 1125 + // which implicitly has all the default values. 1126 + $preferences = id(new PhabricatorUserPreferences()) 1127 + ->attachUser(new PhabricatorUser()); 1128 + } 1129 + 1130 + return $preferences; 1131 + } 1132 + 1133 + private function shouldAddRePrefix(PhabricatorUserPreferences $preferences) { 1134 + $default_value = PhabricatorEnv::getEnvConfig('metamta.re-prefix'); 1135 + 1136 + $value = $preferences->getPreference( 1137 + PhabricatorEmailRePrefixSetting::SETTINGKEY); 1138 + if ($value === null) { 1139 + return $default_value; 1140 + } 1141 + 1142 + return ($value == PhabricatorEmailRePrefixSetting::VALUE_RE_PREFIX); 1143 + } 1144 + 1145 + private function shouldVarySubject(PhabricatorUserPreferences $preferences) { 1146 + $default_value = PhabricatorEnv::getEnvConfig('metamta.vary-subjects'); 1147 + 1148 + $value = $preferences->getPreference( 1149 + PhabricatorEmailVarySubjectsSetting::SETTINGKEY); 1150 + 1151 + if ($value === null) { 1152 + return $default_value; 1153 + } 1154 + 1155 + return ($value == PhabricatorEmailVarySubjectsSetting::VALUE_VARY_SUBJECTS); 1156 + } 1157 + 1158 + private function shouldSendHTML(PhabricatorUserPreferences $preferences) { 1159 + $value = $preferences->getSettingValue( 1160 + PhabricatorEmailFormatSetting::SETTINGKEY); 1161 + 1162 + return ($value == PhabricatorEmailFormatSetting::VALUE_HTML_EMAIL); 1143 1163 } 1144 1164 1145 1165
+40 -20
src/applications/metamta/storage/__tests__/PhabricatorMetaMTAMailTestCase.php
··· 60 60 $user = $this->generateNewTestUser(); 61 61 $phid = $user->getPHID(); 62 62 63 - $prefs = $user->loadPreferences(); 64 - 65 63 $mailer = new PhabricatorMailImplementationTestAdapter(); 66 64 67 65 $mail = new PhabricatorMetaMTAMail(); ··· 79 77 in_array($phid, $mail->buildRecipientList()), 80 78 pht('"From" does not exclude recipients by default.')); 81 79 82 - $prefs->setPreference( 83 - PhabricatorUserPreferences::PREFERENCE_NO_SELF_MAIL, 80 + $user = $this->writeSetting( 81 + $user, 82 + PhabricatorEmailSelfActionsSetting::SETTINGKEY, 84 83 true); 85 - $prefs->save(); 86 84 87 85 $this->assertFalse( 88 86 in_array($phid, $mail->buildRecipientList()), 89 87 pht('"From" excludes recipients with no-self-mail set.')); 90 88 91 - $prefs->unsetPreference( 92 - PhabricatorUserPreferences::PREFERENCE_NO_SELF_MAIL); 93 - $prefs->save(); 89 + $user = $this->writeSetting( 90 + $user, 91 + PhabricatorEmailSelfActionsSetting::SETTINGKEY, 92 + null); 94 93 95 94 $this->assertTrue( 96 95 in_array($phid, $mail->buildRecipientList()), 97 96 pht('"From" does not exclude recipients by default.')); 98 97 99 - $prefs->setPreference( 100 - PhabricatorUserPreferences::PREFERENCE_NO_MAIL, 98 + $user = $this->writeSetting( 99 + $user, 100 + PhabricatorEmailNotificationsSetting::SETTINGKEY, 101 101 true); 102 - $prefs->save(); 103 102 104 103 $this->assertFalse( 105 104 in_array($phid, $mail->buildRecipientList()), ··· 113 112 114 113 $mail->setForceDelivery(false); 115 114 116 - $prefs->unsetPreference( 117 - PhabricatorUserPreferences::PREFERENCE_NO_MAIL); 118 - $prefs->save(); 115 + $user = $this->writeSetting( 116 + $user, 117 + PhabricatorEmailNotificationsSetting::SETTINGKEY, 118 + null); 119 119 120 120 $this->assertTrue( 121 121 in_array($phid, $mail->buildRecipientList()), 122 122 pht('"From" does not exclude recipients by default.')); 123 - 124 123 125 124 // Test that explicit exclusion works correctly. 126 125 $mail->setExcludeMailRecipientPHIDs(array($phid)); ··· 133 132 134 133 135 134 // Test that mail tag preferences exclude recipients. 136 - $prefs->setPreference( 137 - PhabricatorUserPreferences::PREFERENCE_MAILTAGS, 135 + $user = $this->writeSetting( 136 + $user, 137 + PhabricatorEmailTagsSetting::SETTINGKEY, 138 138 array( 139 139 'test-tag' => false, 140 140 )); 141 - $prefs->save(); 142 141 143 142 $mail->setMailTags(array('test-tag')); 144 143 ··· 146 145 in_array($phid, $mail->buildRecipientList()), 147 146 pht('Tag preference excludes recipients.')); 148 147 149 - $prefs->unsetPreference(PhabricatorUserPreferences::PREFERENCE_MAILTAGS); 150 - $prefs->save(); 148 + $user = $this->writeSetting( 149 + $user, 150 + PhabricatorEmailTagsSetting::SETTINGKEY, 151 + null); 151 152 152 153 $this->assertTrue( 153 154 in_array($phid, $mail->buildRecipientList()), ··· 213 214 pht( 214 215 'Expectation about existence of References header for case %s.', 215 216 $case)); 217 + } 218 + 219 + private function writeSetting(PhabricatorUser $user, $key, $value) { 220 + $preferences = PhabricatorUserPreferences::loadUserPreferences($user); 221 + 222 + $editor = id(new PhabricatorUserPreferencesEditor()) 223 + ->setActor($user) 224 + ->setContentSource($this->newContentSource()) 225 + ->setContinueOnNoEffect(true) 226 + ->setContinueOnMissingFields(true); 227 + 228 + $xactions = array(); 229 + $xactions[] = $preferences->newTransaction($key, $value); 230 + $editor->applyTransactions($preferences, $xactions); 231 + 232 + return id(new PhabricatorPeopleQuery()) 233 + ->setViewer($user) 234 + ->withIDs(array($user->getID())) 235 + ->executeOne(); 216 236 } 217 237 218 238 }
+24
src/applications/settings/panel/PhabricatorEmailDeliverySettingsPanel.php
··· 1 + <?php 2 + 3 + final class PhabricatorEmailDeliverySettingsPanel 4 + extends PhabricatorEditEngineSettingsPanel { 5 + 6 + const PANELKEY = 'emaildelivery'; 7 + 8 + public function getPanelName() { 9 + return pht('Email Delivery'); 10 + } 11 + 12 + public function getPanelGroupKey() { 13 + return PhabricatorSettingsEmailPanelGroup::PANELGROUPKEY; 14 + } 15 + 16 + public function isEditableByAdministrators() { 17 + if ($this->getUser()->getIsMailingList()) { 18 + return true; 19 + } 20 + 21 + return false; 22 + } 23 + 24 + }
+14 -67
src/applications/settings/panel/PhabricatorEmailPreferencesSettingsPanel.php
··· 27 27 $viewer = $this->getViewer(); 28 28 $user = $this->getUser(); 29 29 30 - $preferences = $user->loadPreferences(); 30 + $preferences = $this->loadTargetPreferences(); 31 31 32 - $pref_no_mail = PhabricatorUserPreferences::PREFERENCE_NO_MAIL; 33 - $pref_no_self_mail = PhabricatorUserPreferences::PREFERENCE_NO_SELF_MAIL; 34 - 35 - $value_email = PhabricatorUserPreferences::MAILTAG_PREFERENCE_EMAIL; 32 + $value_email = PhabricatorEmailTagsSetting::VALUE_EMAIL; 36 33 37 34 $errors = array(); 38 35 if ($request->isFormPost()) { 39 - $preferences->setPreference( 40 - $pref_no_mail, 41 - $request->getStr($pref_no_mail)); 42 - 43 - $preferences->setPreference( 44 - $pref_no_self_mail, 45 - $request->getStr($pref_no_self_mail)); 46 - 47 36 $new_tags = $request->getArr('mailtags'); 48 37 $mailtags = $preferences->getPreference('mailtags', array()); 49 38 $all_tags = $this->getAllTags($user); ··· 51 40 foreach ($all_tags as $key => $label) { 52 41 $mailtags[$key] = (int)idx($new_tags, $key, $value_email); 53 42 } 54 - $preferences->setPreference('mailtags', $mailtags); 55 43 56 - $preferences->save(); 44 + $this->writeSetting( 45 + $preferences, 46 + PhabricatorEmailTagsSetting::SETTINGKEY, 47 + $mailtags); 57 48 58 49 return id(new AphrontRedirectResponse()) 59 50 ->setURI($this->getPanelURI('?saved=true')); 60 51 } 61 52 62 - $form = new AphrontFormView(); 63 - $form 64 - ->setUser($viewer) 65 - ->appendRemarkupInstructions( 66 - pht( 67 - 'These settings let you control how Phabricator notifies you about '. 68 - 'events. You can configure Phabricator to send you an email, '. 69 - 'just send a web notification, or not notify you at all.')) 70 - ->appendRemarkupInstructions( 71 - pht( 72 - 'If you disable **Email Notifications**, Phabricator will never '. 73 - 'send email to notify you about events. This preference overrides '. 74 - 'all your other settings.'. 75 - "\n\n". 76 - "//You may still receive some administrative email, like password ". 77 - "reset email.//")) 78 - ->appendChild( 79 - id(new AphrontFormSelectControl()) 80 - ->setLabel(pht('Email Notifications')) 81 - ->setName($pref_no_mail) 82 - ->setOptions( 83 - array( 84 - '0' => pht('Send me email notifications'), 85 - '1' => pht('Never send email notifications'), 86 - )) 87 - ->setValue($preferences->getPreference($pref_no_mail, 0))) 88 - ->appendRemarkupInstructions( 89 - pht( 90 - 'If you disable **Self Actions**, Phabricator will not notify '. 91 - 'you about actions you take.')) 92 - ->appendChild( 93 - id(new AphrontFormSelectControl()) 94 - ->setLabel(pht('Self Actions')) 95 - ->setName($pref_no_self_mail) 96 - ->setOptions( 97 - array( 98 - '0' => pht('Send me an email when I take an action'), 99 - '1' => pht('Do not send me an email when I take an action'), 100 - )) 101 - ->setValue($preferences->getPreference($pref_no_self_mail, 0))); 53 + $mailtags = $preferences->getSettingValue( 54 + PhabricatorEmailTagsSetting::SETTINGKEY); 102 55 103 - $mailtags = $preferences->getPreference('mailtags', array()); 104 - 105 - $form->appendChild( 106 - id(new PHUIFormDividerControl())); 56 + $form = id(new AphrontFormView()) 57 + ->setUser($viewer); 107 58 108 59 $form->appendRemarkupInstructions( 109 60 pht( ··· 183 134 ->setFormErrors($errors) 184 135 ->setForm($form); 185 136 186 - return id(new AphrontNullView()) 187 - ->appendChild( 188 - array( 189 - $form_box, 190 - )); 137 + return $form_box; 191 138 } 192 139 193 140 private function getAllEditorsWithTags(PhabricatorUser $user) { ··· 222 169 array $tags, 223 170 array $prefs) { 224 171 225 - $value_email = PhabricatorUserPreferences::MAILTAG_PREFERENCE_EMAIL; 226 - $value_notify = PhabricatorUserPreferences::MAILTAG_PREFERENCE_NOTIFY; 227 - $value_ignore = PhabricatorUserPreferences::MAILTAG_PREFERENCE_IGNORE; 172 + $value_email = PhabricatorEmailTagsSetting::VALUE_EMAIL; 173 + $value_notify = PhabricatorEmailTagsSetting::VALUE_NOTIFY; 174 + $value_ignore = PhabricatorEmailTagsSetting::VALUE_IGNORE; 228 175 229 176 $content = array(); 230 177 foreach ($tags as $key => $label) {
+2 -2
src/applications/settings/setting/PhabricatorEmailFormatSetting.php
··· 5 5 6 6 const SETTINGKEY = 'html-emails'; 7 7 8 - const VALUE_HTML_EMAIL = 'true'; 9 - const VALUE_TEXT_EMAIL = 'false'; 8 + const VALUE_HTML_EMAIL = 'html'; 9 + const VALUE_TEXT_EMAIL = 'text'; 10 10 11 11 public function getSettingName() { 12 12 return pht('HTML Email');
+8
src/applications/settings/setting/PhabricatorEmailNotificationsSetting.php
··· 12 12 return pht('Email Notifications'); 13 13 } 14 14 15 + public function getSettingPanelKey() { 16 + return PhabricatorEmailDeliverySettingsPanel::PANELKEY; 17 + } 18 + 19 + protected function getSettingOrder() { 20 + return 100; 21 + } 22 + 15 23 protected function getControlInstructions() { 16 24 return pht( 17 25 'If you disable **Email Notifications**, Phabricator will never '.
+2 -2
src/applications/settings/setting/PhabricatorEmailRePrefixSetting.php
··· 5 5 6 6 const SETTINGKEY = 're-prefix'; 7 7 8 - const VALUE_RE_PREFIX = 'true'; 9 - const VALUE_NO_PREFIX = 'false'; 8 + const VALUE_RE_PREFIX = 're'; 9 + const VALUE_NO_PREFIX = 'none'; 10 10 11 11 public function getSettingName() { 12 12 return pht('Add "Re:" Prefix');
+8
src/applications/settings/setting/PhabricatorEmailSelfActionsSetting.php
··· 12 12 return pht('Self Actions'); 13 13 } 14 14 15 + public function getSettingPanelKey() { 16 + return PhabricatorEmailDeliverySettingsPanel::PANELKEY; 17 + } 18 + 19 + protected function getSettingOrder() { 20 + return 200; 21 + } 22 + 15 23 protected function getControlInstructions() { 16 24 return pht( 17 25 'If you disable **Self Actions**, Phabricator will not notify '.
+21
src/applications/settings/setting/PhabricatorEmailTagsSetting.php
··· 1 + <?php 2 + 3 + final class PhabricatorEmailTagsSetting 4 + extends PhabricatorInternalSetting { 5 + 6 + const SETTINGKEY = 'mailtags'; 7 + 8 + // These are in an unusual order for historic reasons. 9 + const VALUE_NOTIFY = 0; 10 + const VALUE_EMAIL = 1; 11 + const VALUE_IGNORE = 2; 12 + 13 + public function getSettingName() { 14 + return pht('Mail Tags'); 15 + } 16 + 17 + public function getSettingDefaultValue() { 18 + return array(); 19 + } 20 + 21 + }
+3 -3
src/applications/settings/setting/PhabricatorEmailVarySubjectsSetting.php
··· 3 3 final class PhabricatorEmailVarySubjectsSetting 4 4 extends PhabricatorSelectSetting { 5 5 6 - const SETTINGKEY = 'vary-subjects'; 6 + const SETTINGKEY = 'vary-subject'; 7 7 8 - const VALUE_VARY_SUBJECTS = 'true'; 9 - const VALUE_STATIC_SUBJECTS = 'false'; 8 + const VALUE_VARY_SUBJECTS = 'vary'; 9 + const VALUE_STATIC_SUBJECTS = 'static'; 10 10 11 11 public function getSettingName() { 12 12 return pht('Vary Subjects');
-12
src/applications/settings/storage/PhabricatorUserPreferences.php
··· 7 7 PhabricatorDestructibleInterface, 8 8 PhabricatorApplicationTransactionInterface { 9 9 10 - const PREFERENCE_RE_PREFIX = 're-prefix'; 11 - const PREFERENCE_NO_SELF_MAIL = 'self-mail'; 12 - const PREFERENCE_NO_MAIL = 'no-mail'; 13 - const PREFERENCE_MAILTAGS = 'mailtags'; 14 - const PREFERENCE_VARY_SUBJECT = 'vary-subject'; 15 - const PREFERENCE_HTML_EMAILS = 'html-emails'; 16 - 17 - // These are in an unusual order for historic reasons. 18 - const MAILTAG_PREFERENCE_NOTIFY = 0; 19 - const MAILTAG_PREFERENCE_EMAIL = 1; 20 - const MAILTAG_PREFERENCE_IGNORE = 2; 21 - 22 10 protected $userPHID; 23 11 protected $preferences = array(); 24 12