Changeset View
Changeset View
Standalone View
Standalone View
src/applications/people/application/PhabricatorPeopleApplication.php
| Show First 20 Lines • Show All 89 Lines • ▼ Show 20 Lines | return array( | ||||
| PeopleBrowseUserDirectoryCapability::CAPABILITY => array(), | PeopleBrowseUserDirectoryCapability::CAPABILITY => array(), | ||||
| ); | ); | ||||
| } | } | ||||
| public function loadStatus(PhabricatorUser $user) { | public function loadStatus(PhabricatorUser $user) { | ||||
| if (!$user->getIsAdmin()) { | if (!$user->getIsAdmin()) { | ||||
| return array(); | return array(); | ||||
| } | } | ||||
| $limit = self::MAX_STATUS_ITEMS; | |||||
| $need_approval = id(new PhabricatorPeopleQuery()) | $need_approval = id(new PhabricatorPeopleQuery()) | ||||
| ->setViewer($user) | ->setViewer($user) | ||||
| ->withIsApproved(false) | ->withIsApproved(false) | ||||
| ->withIsDisabled(false) | ->withIsDisabled(false) | ||||
| ->setLimit(self::MAX_STATUS_ITEMS) | ->setLimit($limit) | ||||
| ->execute(); | ->execute(); | ||||
| if (!$need_approval) { | if (!$need_approval) { | ||||
| return array(); | return array(); | ||||
| } | } | ||||
| $status = array(); | $status = array(); | ||||
| $count = count($need_approval); | $count = count($need_approval); | ||||
| $count_str = self::formatStatusCount( | if ($count >= $limit) { | ||||
| $count, | $count_str = pht( | ||||
| '%s Users Need Approval', | '%s+ User(s) Need Approval', | ||||
| '%d User(s) Need Approval'); | new PhutilNumber($limit - 1)); | ||||
| } else { | |||||
| $count_str = pht( | |||||
| '%s User(s) Need Approval', | |||||
| new PhutilNumber($count)); | |||||
| } | |||||
| $type = PhabricatorApplicationStatusView::TYPE_NEEDS_ATTENTION; | $type = PhabricatorApplicationStatusView::TYPE_NEEDS_ATTENTION; | ||||
| $status[] = id(new PhabricatorApplicationStatusView()) | $status[] = id(new PhabricatorApplicationStatusView()) | ||||
| ->setType($type) | ->setType($type) | ||||
| ->setText($count_str) | ->setText($count_str) | ||||
| ->setCount($count); | ->setCount($count); | ||||
| return $status; | return $status; | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 75 Lines • Show Last 20 Lines | |||||