@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.) hq.recaptime.dev/wiki/Phorge
phorge phabricator
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Implemented showing the number of objects tracked as application status.

Summary:
Implementing that TODO where we want to show the current number of
objects being tracked by a user on the application icon so that they're
aware of any timers that are running.

Depends on D5479

Test Plan:
Apply this patch and track a Maniphest task. The counter should show
the number of objects you are tracking in the navigation pane of the
main screen

Reviewers: epriestley

CC: aran, Korvin

Maniphest Tasks: T2857

Differential Revision: https://secure.phabricator.com/D5480

authored by

James Rhodes and committed by
epriestley
c3c88fd4 4a5dfd38

+21 -16
+5 -16
src/applications/phrequent/application/PhabricatorApplicationPhrequent.php
··· 45 45 public function loadStatus(PhabricatorUser $user) { 46 46 $status = array(); 47 47 48 - // TODO: Show number of timers that are currently 49 - // running for a user. 48 + // Show number of objects that are currently 49 + // being tracked for a user. 50 50 51 - /* 52 - 53 - $query = id(new ManiphestTaskQuery()) 54 - ->withStatus(ManiphestTaskQuery::STATUS_OPEN) 55 - ->withOwners(array($user->getPHID())) 56 - ->setLimit(1) 57 - ->setCalculateRows(true); 58 - $query->execute(); 59 - 60 - $count = $query->getRowCount(); 61 - $type = PhabricatorApplicationStatusView::TYPE_WARNING; 51 + $count = PhrequentUserTimeQuery::getUserTotalObjectsTracked($user); 52 + $type = PhabricatorApplicationStatusView::TYPE_NEEDS_ATTENTION; 62 53 $status[] = id(new PhabricatorApplicationStatusView()) 63 54 ->setType($type) 64 - ->setText(pht('%d Assigned Task(s)', $count)) 55 + ->setText(pht('%d Object(s) Tracked', $count)) 65 56 ->setCount($count); 66 - 67 - */ 68 57 69 58 return $status; 70 59 }
+16
src/applications/phrequent/query/PhrequentUserTimeQuery.php
··· 79 79 80 80 /* -( Helper Functions ) --------------------------------------------------- */ 81 81 82 + public static function getUserTotalObjectsTracked( 83 + PhabricatorUser $user) { 84 + 85 + $usertime_dao = new PhrequentUserTime(); 86 + $conn = $usertime_dao->establishConnection('r'); 87 + 88 + $count = queryfx_one( 89 + $conn, 90 + 'SELECT COUNT(usertime.id) N FROM %T usertime '. 91 + 'WHERE usertime.userPHID = %s '. 92 + 'AND usertime.dateEnded IS NULL', 93 + $usertime_dao->getTableName(), 94 + $user->getPHID()); 95 + return $count['N']; 96 + } 97 + 82 98 public static function isUserTrackingObject( 83 99 PhabricatorUser $user, 84 100 $phid) {