Changeset View
Changeset View
Standalone View
Standalone View
src/applications/spaces/query/PhabricatorSpacesNamespaceQuery.php
Show First 20 Lines • Show All 97 Lines • ▼ Show 20 Lines | public static function getViewerSpacesExist(PhabricatorUser $viewer) { | ||||
} | } | ||||
// If the viewer has access to only one space, pretend spaces simply don't | // If the viewer has access to only one space, pretend spaces simply don't | ||||
// exist. | // exist. | ||||
$spaces = self::getViewerSpaces($viewer); | $spaces = self::getViewerSpaces($viewer); | ||||
return (count($spaces) > 1); | return (count($spaces) > 1); | ||||
} | } | ||||
public static function getViewerActiveSpacesExist(PhabricatorUser $viewer) { | |||||
if (!self::getSpacesExist()) { | |||||
return false; | |||||
} | |||||
// If the viewer has access to only one active space, pretend active spaces | |||||
// simply don't exist. | |||||
$spaces = self::getViewerActiveSpaces($viewer); | |||||
return (count($spaces) > 1); | |||||
} | |||||
public static function getAllSpaces() { | public static function getAllSpaces() { | ||||
$cache = PhabricatorCaches::getRequestCache(); | $cache = PhabricatorCaches::getRequestCache(); | ||||
$cache_key = self::KEY_ALL; | $cache_key = self::KEY_ALL; | ||||
$spaces = $cache->getKey($cache_key); | $spaces = $cache->getKey($cache_key); | ||||
if ($spaces === null) { | if ($spaces === null) { | ||||
$spaces = id(new PhabricatorSpacesNamespaceQuery()) | $spaces = id(new PhabricatorSpacesNamespaceQuery()) | ||||
->setViewer(PhabricatorUser::getOmnipotentUser()) | ->setViewer(PhabricatorUser::getOmnipotentUser()) | ||||
▲ Show 20 Lines • Show All 125 Lines • Show Last 20 Lines |