Changeset View
Changeset View
Standalone View
Standalone View
src/applications/flag/application/PhabricatorFlagsApplication.php
| Show All 28 Lines | final class PhabricatorFlagsApplication extends PhabricatorApplication { | ||||
| } | } | ||||
| public function getApplicationGroup() { | public function getApplicationGroup() { | ||||
| return self::GROUP_UTILITIES; | return self::GROUP_UTILITIES; | ||||
| } | } | ||||
| public function loadStatus(PhabricatorUser $user) { | public function loadStatus(PhabricatorUser $user) { | ||||
| $status = array(); | $status = array(); | ||||
| $limit = self::MAX_STATUS_ITEMS; | |||||
| $flags = id(new PhabricatorFlagQuery()) | $flags = id(new PhabricatorFlagQuery()) | ||||
| ->setViewer($user) | ->setViewer($user) | ||||
| ->withOwnerPHIDs(array($user->getPHID())) | ->withOwnerPHIDs(array($user->getPHID())) | ||||
| ->setLimit(self::MAX_STATUS_ITEMS) | ->setLimit(self::MAX_STATUS_ITEMS) | ||||
| ->execute(); | ->execute(); | ||||
| $count = count($flags); | $count = count($flags); | ||||
| $count_str = self::formatStatusCount( | if ($count >= $limit) { | ||||
| $count, | $count_str = pht('%s+ Flagged Object(s)', new PhutilNumber($limit - 1)); | ||||
| '%s Flagged Objects', | } else { | ||||
| '%d Flagged Object(s)'); | $count_str = pht('%s Flagged Object(s)', new PhutilNumber($count)); | ||||
| } | |||||
| $type = PhabricatorApplicationStatusView::TYPE_WARNING; | $type = PhabricatorApplicationStatusView::TYPE_WARNING; | ||||
| $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 All 13 Lines | |||||