Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F14012136
D16027.id38579.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
7 KB
Referenced Files
None
Subscribers
None
D16027.id38579.diff
View Options
diff --git a/src/__phutil_library_map__.php b/src/__phutil_library_map__.php
--- a/src/__phutil_library_map__.php
+++ b/src/__phutil_library_map__.php
@@ -3031,6 +3031,7 @@
'PhabricatorPolicyEditField' => 'applications/transactions/editfield/PhabricatorPolicyEditField.php',
'PhabricatorPolicyException' => 'applications/policy/exception/PhabricatorPolicyException.php',
'PhabricatorPolicyExplainController' => 'applications/policy/controller/PhabricatorPolicyExplainController.php',
+ 'PhabricatorPolicyFavoritesSetting' => 'applications/settings/setting/PhabricatorPolicyFavoritesSetting.php',
'PhabricatorPolicyFilter' => 'applications/policy/filter/PhabricatorPolicyFilter.php',
'PhabricatorPolicyInterface' => 'applications/policy/interface/PhabricatorPolicyInterface.php',
'PhabricatorPolicyManagementShowWorkflow' => 'applications/policy/management/PhabricatorPolicyManagementShowWorkflow.php',
@@ -7706,6 +7707,7 @@
'PhabricatorPolicyEditField' => 'PhabricatorEditField',
'PhabricatorPolicyException' => 'Exception',
'PhabricatorPolicyExplainController' => 'PhabricatorPolicyController',
+ 'PhabricatorPolicyFavoritesSetting' => 'PhabricatorInternalSetting',
'PhabricatorPolicyFilter' => 'Phobject',
'PhabricatorPolicyInterface' => 'PhabricatorPHIDInterface',
'PhabricatorPolicyManagementShowWorkflow' => 'PhabricatorPolicyManagementWorkflow',
diff --git a/src/applications/people/storage/PhabricatorUser.php b/src/applications/people/storage/PhabricatorUser.php
--- a/src/applications/people/storage/PhabricatorUser.php
+++ b/src/applications/people/storage/PhabricatorUser.php
@@ -606,15 +606,6 @@
$preferences = new PhabricatorUserPreferences();
$preferences->setUserPHID($this->getPHID());
$preferences->attachUser($this);
-
- $default_dict = array(
- PhabricatorUserPreferences::PREFERENCE_TITLES => 'glyph',
- PhabricatorUserPreferences::PREFERENCE_EDITOR => '',
- PhabricatorUserPreferences::PREFERENCE_MONOSPACED => '',
- PhabricatorUserPreferences::PREFERENCE_DARK_CONSOLE => 0,
- );
-
- $preferences->setPreferences($default_dict);
}
$this->preferences = $preferences;
diff --git a/src/applications/policy/controller/PhabricatorPolicyEditController.php b/src/applications/policy/controller/PhabricatorPolicyEditController.php
--- a/src/applications/policy/controller/PhabricatorPolicyEditController.php
+++ b/src/applications/policy/controller/PhabricatorPolicyEditController.php
@@ -281,10 +281,8 @@
// Save this project as one of the user's most recently used projects,
// so we'll show it by default in future menus.
- $pref_key = PhabricatorUserPreferences::PREFERENCE_FAVORITE_POLICIES;
-
- $preferences = $viewer->loadPreferences();
- $favorites = $preferences->getPreference($pref_key);
+ $favorites_key = PhabricatorPolicyFavoritesSetting::SETTINGKEY;
+ $favorites = $viewer->getUserSetting($favorites_key);
if (!is_array($favorites)) {
$favorites = array();
}
@@ -293,8 +291,17 @@
unset($favorites[$project_phid]);
$favorites[$project_phid] = true;
- $preferences->setPreference($pref_key, $favorites);
- $preferences->save();
+ $preferences = PhabricatorUserPreferences::loadUserPreferences($viewer);
+
+ $editor = id(new PhabricatorUserPreferencesEditor())
+ ->setActor($viewer)
+ ->setContentSourceFromRequest($request)
+ ->setContinueOnNoEffect(true)
+ ->setContinueOnMissingFields(true);
+
+ $xactions = array();
+ $xactions[] = $preferences->newTransaction($favorites_key, $favorites);
+ $editor->applyTransactions($preferences, $xactions);
$data = array(
'phid' => $project->getPHID(),
diff --git a/src/applications/policy/query/PhabricatorPolicyQuery.php b/src/applications/policy/query/PhabricatorPolicyQuery.php
--- a/src/applications/policy/query/PhabricatorPolicyQuery.php
+++ b/src/applications/policy/query/PhabricatorPolicyQuery.php
@@ -195,7 +195,7 @@
$viewer = $this->getViewer();
if ($viewer->getPHID()) {
- $pref_key = PhabricatorUserPreferences::PREFERENCE_FAVORITE_POLICIES;
+ $pref_key = PhabricatorPolicyFavoritesSetting::SETTINGKEY;
$favorite_limit = 10;
$default_limit = 5;
diff --git a/src/applications/settings/setting/PhabricatorPolicyFavoritesSetting.php b/src/applications/settings/setting/PhabricatorPolicyFavoritesSetting.php
new file mode 100644
--- /dev/null
+++ b/src/applications/settings/setting/PhabricatorPolicyFavoritesSetting.php
@@ -0,0 +1,16 @@
+<?php
+
+final class PhabricatorPolicyFavoritesSetting
+ extends PhabricatorInternalSetting {
+
+ const SETTINGKEY = 'policy.favorites';
+
+ public function getSettingName() {
+ return pht('Policy Favorites');
+ }
+
+ public function getSettingDefaultValue() {
+ return array();
+ }
+
+}
diff --git a/src/applications/settings/storage/PhabricatorUserPreferences.php b/src/applications/settings/storage/PhabricatorUserPreferences.php
--- a/src/applications/settings/storage/PhabricatorUserPreferences.php
+++ b/src/applications/settings/storage/PhabricatorUserPreferences.php
@@ -7,16 +7,6 @@
PhabricatorDestructibleInterface,
PhabricatorApplicationTransactionInterface {
- const PREFERENCE_MONOSPACED = 'monospaced';
- const PREFERENCE_DARK_CONSOLE = 'dark_console';
- const PREFERENCE_EDITOR = 'editor';
- const PREFERENCE_MULTIEDIT = 'multiedit';
- const PREFERENCE_TITLES = 'titles';
- const PREFERENCE_MONOSPACED_TEXTAREAS = 'monospaced-textareas';
- const PREFERENCE_DATE_FORMAT = 'date-format';
- const PREFERENCE_TIME_FORMAT = 'time-format';
- const PREFERENCE_WEEK_START_DAY = 'week-start-day';
-
const PREFERENCE_RE_PREFIX = 're-prefix';
const PREFERENCE_NO_SELF_MAIL = 'self-mail';
const PREFERENCE_NO_MAIL = 'no-mail';
@@ -25,22 +15,12 @@
const PREFERENCE_HTML_EMAILS = 'html-emails';
const PREFERENCE_NAV_COLLAPSED = 'nav-collapsed';
- const PREFERENCE_NAV_WIDTH = 'nav-width';
const PREFERENCE_APP_TILES = 'app-tiles';
const PREFERENCE_APP_PINNED = 'app-pinned';
- const PREFERENCE_DIFF_UNIFIED = 'diff-unified';
- const PREFERENCE_DIFF_FILETREE = 'diff-filetree';
- const PREFERENCE_DIFF_GHOSTS = 'diff-ghosts';
-
- const PREFERENCE_CONPH_NOTIFICATIONS = 'conph-notifications';
const PREFERENCE_CONPHERENCE_COLUMN = 'conpherence-column';
-
- const PREFERENCE_RESOURCE_POSTPROCESSOR = 'resource-postprocessor';
const PREFERENCE_DESKTOP_NOTIFICATIONS = 'desktop-notifications';
-
const PREFERENCE_PROFILE_MENU_COLLAPSED = 'profile-menu.collapsed';
- const PREFERENCE_FAVORITE_POLICIES = 'policy.favorites';
// These are in an unusual order for historic reasons.
const MAILTAG_PREFERENCE_NOTIFY = 0;
diff --git a/src/view/phui/calendar/PHUICalendarMonthView.php b/src/view/phui/calendar/PHUICalendarMonthView.php
--- a/src/view/phui/calendar/PHUICalendarMonthView.php
+++ b/src/view/phui/calendar/PHUICalendarMonthView.php
@@ -575,7 +575,7 @@
private function getWeekStartAndEnd() {
$viewer = $this->getViewer();
- $week_key = PhabricatorUserPreferences::PREFERENCE_WEEK_START_DAY;
+ $week_key = PhabricatorWeekStartDaySetting::SETTINGKEY;
$week_start = $viewer->getUserSetting($week_key);
$week_end = ($week_start + 6) % 7;
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sat, Nov 2, 7:23 AM (2 w, 2 d ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
6735378
Default Alt Text
D16027.id38579.diff (7 KB)
Attached To
Mode
D16027: Modernize "favorite project policies" setting
Attached
Detach File
Event Timeline
Log In to Comment