Page MenuHomePhabricator

D10979.diff
No OneTemporary

D10979.diff

diff --git a/src/applications/audit/application/PhabricatorAuditApplication.php b/src/applications/audit/application/PhabricatorAuditApplication.php
--- a/src/applications/audit/application/PhabricatorAuditApplication.php
+++ b/src/applications/audit/application/PhabricatorAuditApplication.php
@@ -54,28 +54,38 @@
$query = id(new DiffusionCommitQuery())
->setViewer($user)
->withAuthorPHIDs(array($user->getPHID()))
- ->withAuditStatus(DiffusionCommitQuery::AUDIT_STATUS_CONCERN);
+ ->withAuditStatus(DiffusionCommitQuery::AUDIT_STATUS_CONCERN)
+ ->setLimit(self::MAX_STATUS_ITEMS);
$commits = $query->execute();
$count = count($commits);
+ $count_str = self::formatStatusCount(
+ $count,
+ '%s Problem Commits',
+ '%d Problem Commit(s)');
$type = PhabricatorApplicationStatusView::TYPE_NEEDS_ATTENTION;
$status[] = id(new PhabricatorApplicationStatusView())
->setType($type)
- ->setText(pht('%d Problem Commit(s)', $count))
+ ->setText($count_str)
->setCount($count);
$query = id(new DiffusionCommitQuery())
->setViewer($user)
->withAuditorPHIDs($phids)
->withAuditStatus(DiffusionCommitQuery::AUDIT_STATUS_OPEN)
- ->withAuditAwaitingUser($user);
+ ->withAuditAwaitingUser($user)
+ ->setLimit(self::MAX_STATUS_ITEMS);
$commits = $query->execute();
$count = count($commits);
+ $count_str = self::formatStatusCount(
+ $count,
+ '%s Commits Awaiting Audit',
+ '%d Commit(s) Awaiting Audit');
$type = PhabricatorApplicationStatusView::TYPE_WARNING;
$status[] = id(new PhabricatorApplicationStatusView())
->setType($type)
- ->setText(pht('%d Commit(s) Awaiting Audit', $count))
+ ->setText($count_str)
->setCount($count);
return $status;
diff --git a/src/applications/base/PhabricatorApplication.php b/src/applications/base/PhabricatorApplication.php
--- a/src/applications/base/PhabricatorApplication.php
+++ b/src/applications/base/PhabricatorApplication.php
@@ -9,6 +9,8 @@
*/
abstract class PhabricatorApplication implements PhabricatorPolicyInterface {
+ const MAX_STATUS_ITEMS = 100;
+
const GROUP_CORE = 'core';
const GROUP_UTILITIES = 'util';
const GROUP_ADMIN = 'admin';
@@ -231,6 +233,22 @@
return array();
}
+ /**
+ * @return string
+ * @task ui
+ */
+ public static function formatStatusCount(
+ $count,
+ $limit_string = '%s',
+ $base_string = '%d') {
+ if ($count == self::MAX_STATUS_ITEMS) {
+ $count_str = pht($limit_string, ($count - 1).'+');
+ } else {
+ $count_str = pht($base_string, $count);
+ }
+ return $count_str;
+ }
+
/**
* You can provide an optional piece of flavor text for the application. This
diff --git a/src/applications/differential/application/PhabricatorDifferentialApplication.php b/src/applications/differential/application/PhabricatorDifferentialApplication.php
--- a/src/applications/differential/application/PhabricatorDifferentialApplication.php
+++ b/src/applications/differential/application/PhabricatorDifferentialApplication.php
@@ -100,35 +100,60 @@
->withResponsibleUsers(array($user->getPHID()))
->withStatus(DifferentialRevisionQuery::STATUS_OPEN)
->needRelationships(true)
+ ->setLimit(self::MAX_STATUS_ITEMS)
->execute();
- list($blocking, $active, $waiting) =
- DifferentialRevisionQuery::splitResponsible(
- $revisions,
- array($user->getPHID()));
-
$status = array();
-
- $blocking = count($blocking);
- $type = PhabricatorApplicationStatusView::TYPE_NEEDS_ATTENTION;
- $status[] = id(new PhabricatorApplicationStatusView())
- ->setType($type)
- ->setText(pht('%d Review(s) Blocking Others', $blocking))
- ->setCount($blocking);
-
- $active = count($active);
- $type = PhabricatorApplicationStatusView::TYPE_WARNING;
- $status[] = id(new PhabricatorApplicationStatusView())
- ->setType($type)
- ->setText(pht('%d Review(s) Need Attention', $active))
- ->setCount($active);
-
- $waiting = count($waiting);
- $type = PhabricatorApplicationStatusView::TYPE_INFO;
- $status[] = id(new PhabricatorApplicationStatusView())
- ->setType($type)
- ->setText(pht('%d Review(s) Waiting on Others', $waiting))
- ->setCount($waiting);
+ if (count($revisions) == self::MAX_STATUS_ITEMS) {
+ $all_count = count($revisions);
+ $all_count_str = self::formatStatusCount(
+ $all_count,
+ '%s Active Reviews',
+ '%d Active Review(s)');
+ $type = PhabricatorApplicationStatusView::TYPE_WARNING;
+ $status[] = id(new PhabricatorApplicationStatusView())
+ ->setType($type)
+ ->setText($all_count_str)
+ ->setCount($all_count);
+ } else {
+ list($blocking, $active, $waiting) =
+ DifferentialRevisionQuery::splitResponsible(
+ $revisions,
+ array($user->getPHID()));
+
+ $blocking = count($blocking);
+ $blocking_str = self::formatStatusCount(
+ $blocking,
+ '%s Reviews Blocking Others',
+ '%d Review(s) Blocking Others');
+ $type = PhabricatorApplicationStatusView::TYPE_NEEDS_ATTENTION;
+ $status[] = id(new PhabricatorApplicationStatusView())
+ ->setType($type)
+ ->setText($blocking_str)
+ ->setCount($blocking);
+
+ $active = count($active);
+ $active_str = self::formatStatusCount(
+ $active,
+ '%s Reviews Need Attention',
+ '%d Review(s) Need Attention');
+ $type = PhabricatorApplicationStatusView::TYPE_WARNING;
+ $status[] = id(new PhabricatorApplicationStatusView())
+ ->setType($type)
+ ->setText($active_str)
+ ->setCount($active);
+
+ $waiting = count($waiting);
+ $waiting_str = self::formatStatusCount(
+ $waiting,
+ '%s Reviews Waiting on Others',
+ '%d Review(s) Waiting on Others');
+ $type = PhabricatorApplicationStatusView::TYPE_INFO;
+ $status[] = id(new PhabricatorApplicationStatusView())
+ ->setType($type)
+ ->setText($waiting_str)
+ ->setCount($waiting);
+ }
return $status;
}
diff --git a/src/applications/flag/application/PhabricatorFlagsApplication.php b/src/applications/flag/application/PhabricatorFlagsApplication.php
--- a/src/applications/flag/application/PhabricatorFlagsApplication.php
+++ b/src/applications/flag/application/PhabricatorFlagsApplication.php
@@ -38,13 +38,18 @@
$flags = id(new PhabricatorFlagQuery())
->setViewer($user)
->withOwnerPHIDs(array($user->getPHID()))
+ ->setLimit(self::MAX_STATUS_ITEMS)
->execute();
$count = count($flags);
+ $count_str = self::formatStatusCount(
+ $count,
+ '%s Flagged Objects',
+ '%d Flagged Object(s)');
$type = PhabricatorApplicationStatusView::TYPE_WARNING;
$status[] = id(new PhabricatorApplicationStatusView())
->setType($type)
- ->setText(pht('%d Flagged Object(s)', $count))
+ ->setText($count_str)
->setCount($count);
return $status;
diff --git a/src/applications/maniphest/application/PhabricatorManiphestApplication.php b/src/applications/maniphest/application/PhabricatorManiphestApplication.php
--- a/src/applications/maniphest/application/PhabricatorManiphestApplication.php
+++ b/src/applications/maniphest/application/PhabricatorManiphestApplication.php
@@ -80,13 +80,18 @@
$query = id(new ManiphestTaskQuery())
->setViewer($user)
->withStatuses(ManiphestTaskStatus::getOpenStatusConstants())
- ->withOwners(array($user->getPHID()));
+ ->withOwners(array($user->getPHID()))
+ ->setLimit(self::MAX_STATUS_ITEMS);
$count = count($query->execute());
+ $count_str = self::formatStatusCount(
+ $count,
+ '%s Assigned Tasks',
+ '%d Assigned Task(s)');
$type = PhabricatorApplicationStatusView::TYPE_WARNING;
$status[] = id(new PhabricatorApplicationStatusView())
->setType($type)
- ->setText(pht('%s Assigned Task(s)', new PhutilNumber($count)))
+ ->setText($count_str)
->setCount($count);
return $status;
diff --git a/src/applications/meta/view/PhabricatorApplicationLaunchView.php b/src/applications/meta/view/PhabricatorApplicationLaunchView.php
--- a/src/applications/meta/view/PhabricatorApplicationLaunchView.php
+++ b/src/applications/meta/view/PhabricatorApplicationLaunchView.php
@@ -73,7 +73,7 @@
array(
'class' => 'phabricator-application-attention-count',
),
- $count);
+ PhabricatorApplication::formatStatusCount($count));
}
@@ -83,7 +83,7 @@
array(
'class' => 'phabricator-application-warning-count',
),
- $counts[$warning]);
+ PhabricatorApplication::formatStatusCount($counts[$warning]));
}
if (nonempty($count1) && nonempty($count2)) {
$numbers = array($count1, ' / ', $count2);
diff --git a/src/applications/people/application/PhabricatorPeopleApplication.php b/src/applications/people/application/PhabricatorPeopleApplication.php
--- a/src/applications/people/application/PhabricatorPeopleApplication.php
+++ b/src/applications/people/application/PhabricatorPeopleApplication.php
@@ -91,6 +91,7 @@
->setViewer($user)
->withIsApproved(false)
->withIsDisabled(false)
+ ->setLimit(self::MAX_STATUS_ITEMS)
->execute();
if (!$need_approval) {
@@ -100,10 +101,14 @@
$status = array();
$count = count($need_approval);
+ $count_str = self::formatStatusCount(
+ $count,
+ '%s Users Need Approval',
+ '%d User(s) Need Approval');
$type = PhabricatorApplicationStatusView::TYPE_NEEDS_ATTENTION;
$status[] = id(new PhabricatorApplicationStatusView())
->setType($type)
- ->setText(pht('%d User(s) Need Approval', $count))
+ ->setText($count_str)
->setCount($count);
return $status;
diff --git a/src/applications/phrequent/application/PhabricatorPhrequentApplication.php b/src/applications/phrequent/application/PhabricatorPhrequentApplication.php
--- a/src/applications/phrequent/application/PhabricatorPhrequentApplication.php
+++ b/src/applications/phrequent/application/PhabricatorPhrequentApplication.php
@@ -52,11 +52,17 @@
// Show number of objects that are currently
// being tracked for a user.
- $count = PhrequentUserTimeQuery::getUserTotalObjectsTracked($user);
+ $count = PhrequentUserTimeQuery::getUserTotalObjectsTracked(
+ $user,
+ self::MAX_STATUS_ITEMS);
+ $count_str = self::formatStatusCount(
+ $count,
+ '%s Objects Tracked',
+ '%d Object(s) Tracked');
$type = PhabricatorApplicationStatusView::TYPE_NEEDS_ATTENTION;
$status[] = id(new PhabricatorApplicationStatusView())
->setType($type)
- ->setText(pht('%d Object(s) Tracked', $count))
+ ->setText($count_str)
->setCount($count);
return $status;
diff --git a/src/applications/phrequent/query/PhrequentUserTimeQuery.php b/src/applications/phrequent/query/PhrequentUserTimeQuery.php
--- a/src/applications/phrequent/query/PhrequentUserTimeQuery.php
+++ b/src/applications/phrequent/query/PhrequentUserTimeQuery.php
@@ -255,7 +255,8 @@
}
public static function getUserTotalObjectsTracked(
- PhabricatorUser $user) {
+ PhabricatorUser $user,
+ $limit = PHP_INT_MAX) {
$usertime_dao = new PhrequentUserTime();
$conn = $usertime_dao->establishConnection('r');
@@ -264,9 +265,11 @@
$conn,
'SELECT COUNT(usertime.id) N FROM %T usertime '.
'WHERE usertime.userPHID = %s '.
- 'AND usertime.dateEnded IS NULL',
+ 'AND usertime.dateEnded IS NULL '.
+ 'LIMIT %d',
$usertime_dao->getTableName(),
- $user->getPHID());
+ $user->getPHID(),
+ $limit);
return $count['N'];
}
diff --git a/src/applications/ponder/application/PhabricatorPonderApplication.php b/src/applications/ponder/application/PhabricatorPonderApplication.php
--- a/src/applications/ponder/application/PhabricatorPonderApplication.php
+++ b/src/applications/ponder/application/PhabricatorPonderApplication.php
@@ -30,6 +30,7 @@
public function loadStatus(PhabricatorUser $user) {
// replace with "x new unanswered questions" or some such
+ // make sure to use self::formatStatusCount and friends...!
$status = array();
return $status;
diff --git a/src/infrastructure/internationalization/translation/PhabricatorBaseEnglishTranslation.php b/src/infrastructure/internationalization/translation/PhabricatorBaseEnglishTranslation.php
--- a/src/infrastructure/internationalization/translation/PhabricatorBaseEnglishTranslation.php
+++ b/src/infrastructure/internationalization/translation/PhabricatorBaseEnglishTranslation.php
@@ -172,11 +172,21 @@
'%d Reviews Waiting on Others',
),
+ '%d Active Review(s)' => array(
+ '%d Active Review',
+ '%d Active Reviews',
+ ),
+
'%d Flagged Object(s)' => array(
'%d Flagged Object',
'%d Flagged Objects',
),
+ '%d Object(s) Tracked' => array(
+ '%d Object Tracked',
+ '%d Objects Tracked',
+ ),
+
'%d Unbreak Now Task(s)!' => array(
'%d Unbreak Now Task!',
'%d Unbreak Now Tasks!',

File Metadata

Mime Type
text/plain
Expires
Tue, Oct 22, 7:40 AM (4 w, 1 d ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
6729316
Default Alt Text
D10979.diff (13 KB)

Event Timeline