Changeset View
Changeset View
Standalone View
Standalone View
src/applications/settings/storage/PhabricatorUserPreferences.php
Show All 18 Lines | final class PhabricatorUserPreferences extends PhabricatorUserDAO { | ||||
const PREFERENCE_SEARCH_SHORTCUT = 'search-shortcut'; | const PREFERENCE_SEARCH_SHORTCUT = 'search-shortcut'; | ||||
const PREFERENCE_DIFFUSION_BLAME = 'diffusion-blame'; | const PREFERENCE_DIFFUSION_BLAME = 'diffusion-blame'; | ||||
const PREFERENCE_DIFFUSION_COLOR = 'diffusion-color'; | const PREFERENCE_DIFFUSION_COLOR = 'diffusion-color'; | ||||
const PREFERENCE_NAV_COLLAPSED = 'nav-collapsed'; | const PREFERENCE_NAV_COLLAPSED = 'nav-collapsed'; | ||||
const PREFERENCE_NAV_WIDTH = 'nav-width'; | const PREFERENCE_NAV_WIDTH = 'nav-width'; | ||||
const PREFERENCE_APP_TILES = 'app-tiles'; | const PREFERENCE_APP_TILES = 'app-tiles'; | ||||
const PREFERENCE_APP_PINNED = 'app-pinned'; | |||||
const PREFERENCE_DIFF_FILETREE = 'diff-filetree'; | const PREFERENCE_DIFF_FILETREE = 'diff-filetree'; | ||||
const PREFERENCE_CONPH_NOTIFICATIONS = 'conph-notifications'; | const PREFERENCE_CONPH_NOTIFICATIONS = 'conph-notifications'; | ||||
protected $userPHID; | protected $userPHID; | ||||
protected $preferences = array(); | protected $preferences = array(); | ||||
Show All 15 Lines | public function setPreference($key, $value) { | ||||
return $this; | return $this; | ||||
} | } | ||||
public function unsetPreference($key) { | public function unsetPreference($key) { | ||||
unset($this->preferences[$key]); | unset($this->preferences[$key]); | ||||
return $this; | return $this; | ||||
} | } | ||||
public function getPinnedApplications(array $apps, PhabricatorUser $viewer) { | |||||
$pref_pinned = PhabricatorUserPreferences::PREFERENCE_APP_PINNED; | |||||
$pinned = $this->getPreference($pref_pinned); | |||||
if ($pinned) { | |||||
return $pinned; | |||||
} | |||||
$pref_tiles = PhabricatorUserPreferences::PREFERENCE_APP_TILES; | |||||
$tiles = $this->getPreference($pref_tiles, array()); | |||||
$large = array(); | |||||
foreach ($apps as $app) { | |||||
$tile = $app->getDefaultTileDisplay($viewer); | |||||
if (isset($tiles[get_class($app)])) { | |||||
$tile = $tiles[get_class($app)]; | |||||
} | |||||
if ($tile == PhabricatorApplication::TILE_FULL) { | |||||
$large[] = get_class($app); | |||||
} | |||||
} | |||||
return $large; | |||||
} | |||||
} | } |