Changeset View
Changeset View
Standalone View
Standalone View
src/applications/policy/query/PhabricatorPolicyQuery.php
| Show First 20 Lines • Show All 195 Lines • ▼ Show 20 Lines | private function loadObjectPolicyPHIDs() { | ||||
| if ($viewer->getPHID()) { | if ($viewer->getPHID()) { | ||||
| $pref_key = PhabricatorUserPreferences::PREFERENCE_FAVORITE_POLICIES; | $pref_key = PhabricatorUserPreferences::PREFERENCE_FAVORITE_POLICIES; | ||||
| $favorite_limit = 10; | $favorite_limit = 10; | ||||
| $default_limit = 5; | $default_limit = 5; | ||||
| // If possible, show the user's 10 most recently used projects. | // If possible, show the user's 10 most recently used projects. | ||||
| $preferences = $viewer->loadPreferences(); | $favorites = $viewer->getUserSetting($pref_key); | ||||
| $favorites = $preferences->getPreference($pref_key); | |||||
| if (!is_array($favorites)) { | if (!is_array($favorites)) { | ||||
| $favorites = array(); | $favorites = array(); | ||||
| } | } | ||||
| $favorite_phids = array_keys($favorites); | $favorite_phids = array_keys($favorites); | ||||
| $favorite_phids = array_slice($favorite_phids, -$favorite_limit); | $favorite_phids = array_slice($favorite_phids, -$favorite_limit); | ||||
| if ($favorite_phids) { | if ($favorite_phids) { | ||||
| $projects = id(new PhabricatorProjectQuery()) | $projects = id(new PhabricatorProjectQuery()) | ||||
| ▲ Show 20 Lines • Show All 216 Lines • Show Last 20 Lines | |||||