@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.

Fix 403s in Phrequent by rendering actions as forms, and make properties fancier

Summary:
Also cleans up some stuff like logged out users a bit. This provides a more subtle alternative to {D5485}.

(This is fairly rough, and the icons need to be sprited if we stick with this approach.)

Test Plan:
{F38047}
{F38048}

Reviewers: hach-que, btrahan

Reviewed By: hach-que

CC: aran, chad

Maniphest Tasks: T2857

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

+114 -13
+23
src/__celerity_resource_map__.php
··· 448 448 'disk' => '/rsrc/image/menu_texture.png', 449 449 'type' => 'png', 450 450 ), 451 + '/rsrc/image/phrequent_active.png' => 452 + array( 453 + 'hash' => '716cddc08630eaa33934b2008723cac0', 454 + 'uri' => '/res/716cddc0/rsrc/image/phrequent_active.png', 455 + 'disk' => '/rsrc/image/phrequent_active.png', 456 + 'type' => 'png', 457 + ), 458 + '/rsrc/image/phrequent_inactive.png' => 459 + array( 460 + 'hash' => 'f9099683873c01c5de1dc6650bd668fe', 461 + 'uri' => '/res/f9099683/rsrc/image/phrequent_inactive.png', 462 + 'disk' => '/rsrc/image/phrequent_inactive.png', 463 + 'type' => 'png', 464 + ), 451 465 '/rsrc/image/search.png' => 452 466 array( 453 467 'hash' => 'ff7da044e6f923b8f569dec11f97e5e5', ··· 3438 3452 array( 3439 3453 ), 3440 3454 'disk' => '/rsrc/css/application/pholio/pholio-inline-comments.css', 3455 + ), 3456 + 'phrequent-css' => 3457 + array( 3458 + 'uri' => '/res/8fc8f63c/rsrc/css/application/phrequent/phrequent.css', 3459 + 'type' => 'css', 3460 + 'requires' => 3461 + array( 3462 + ), 3463 + 'disk' => '/rsrc/css/application/phrequent/phrequent.css', 3441 3464 ), 3442 3465 'phriction-document-css' => 3443 3466 array(
+2 -1
src/applications/phrequent/controller/PhrequentTrackController.php
··· 1 1 <?php 2 2 3 3 final class PhrequentTrackController 4 - extends PhabricatorApplicationsController { 4 + extends PhrequentController { 5 5 6 6 private $verb; 7 7 private $phid; ··· 25 25 } else if ($this->isStoppingTracking()) { 26 26 $this->stopTracking($user, $this->phid); 27 27 } 28 + 28 29 return id(new AphrontRedirectResponse()); 29 30 } 30 31
+58 -12
src/applications/phrequent/event/PhrequentUIEventListener.php
··· 38 38 $object->getPHID()); 39 39 if (!$tracking) { 40 40 $track_action = id(new PhabricatorActionView()) 41 - ->setName(pht('Track Time')) 42 - ->setIcon('history') 43 - ->setWorkflow(true) 44 - ->setHref('/phrequent/track/start/'.$object->getPHID().'/'); 41 + ->setUser($user) 42 + ->setName(pht('Start Tracking Time')) 43 + ->setIcon('history') 44 + ->setWorkflow(true) 45 + ->setRenderAsForm(true) 46 + ->setHref('/phrequent/track/start/'.$object->getPHID().'/'); 45 47 } else { 46 48 $track_action = id(new PhabricatorActionView()) 47 - ->setName(pht('Stop Tracking')) 48 - ->setIcon('history') 49 - ->setWorkflow(true) 50 - ->setHref('/phrequent/track/stop/'.$object->getPHID().'/'); 49 + ->setUser($user) 50 + ->setName(pht('Stop Tracking Time')) 51 + ->setIcon('history') 52 + ->setWorkflow(true) 53 + ->setRenderAsForm(true) 54 + ->setHref('/phrequent/track/stop/'.$object->getPHID().'/'); 55 + } 56 + 57 + if (!$user->isLoggedIn()) { 58 + $track_action->setDisabled(true); 51 59 } 52 60 53 61 $actions = $event->getValue('actions'); ··· 69 77 return; 70 78 } 71 79 80 + $depth = false; 81 + 82 + $stack = PhrequentUserTimeQuery::loadUserStack($user); 83 + if ($stack) { 84 + $stack = array_values($stack); 85 + for ($ii = 0; $ii < count($stack); $ii++) { 86 + if ($stack[$ii]->getObjectPHID() == $object->getPHID()) { 87 + $depth = ($ii + 1); 88 + break; 89 + } 90 + } 91 + } 92 + 72 93 $time_spent = PhrequentUserTimeQuery::getTotalTimeSpentOnObject( 73 94 $object->getPHID()); 95 + 96 + if (!$depth && !$time_spent) { 97 + return; 98 + } 99 + 100 + require_celerity_resource('phrequent-css'); 101 + 102 + $property = array(); 103 + if ($depth == 1) { 104 + $property[] = phutil_tag( 105 + 'div', 106 + array( 107 + 'class' => 'phrequent-tracking-property phrequent-active', 108 + ), 109 + pht('Currently Tracking')); 110 + } else if ($depth > 1) { 111 + $property[] = phutil_tag( 112 + 'div', 113 + array( 114 + 'class' => 'phrequent-tracking-property phrequent-on-stack', 115 + ), 116 + pht('On Stack')); 117 + } 118 + 119 + if ($time_spent) { 120 + $property[] = phabricator_format_relative_time_detailed($time_spent); 121 + } 122 + 74 123 $view = $event->getValue('view'); 75 - $view->addProperty( 76 - pht('Time Spent'), 77 - $time_spent == 0 ? 'none' : 78 - phabricator_format_relative_time_detailed($time_spent)); 124 + $view->addProperty(pht('Time Spent'), $property); 79 125 } 80 126 81 127 }
+11
src/applications/phrequent/query/PhrequentUserTimeQuery.php
··· 114 114 return $count['N'] > 0; 115 115 } 116 116 117 + public static function loadUserStack(PhabricatorUser $user) { 118 + if (!$user->isLoggedIn()) { 119 + return array(); 120 + } 121 + 122 + return id(new PhrequentUserTime())->loadAllWhere( 123 + 'userPHID = %s AND dateEnded IS NULL 124 + ORDER BY dateStarted DESC, id DESC', 125 + $user->getPHID()); 126 + } 127 + 117 128 public static function getTotalTimeSpentOnObject($phid) { 118 129 $usertime_dao = new PhrequentUserTime(); 119 130 $conn = $usertime_dao->establishConnection('r');
+20
webroot/rsrc/css/application/phrequent/phrequent.css
··· 1 + /** 2 + * @provides phrequent-css 3 + */ 4 + 5 + .phrequent-tracking-property { 6 + padding: 6px 6px 6px 28px; 7 + margin-bottom: 2px; 8 + background: #e9e9e9; 9 + background-repeat: no-repeat; 10 + background-position: 6px center; 11 + } 12 + 13 + .phrequent-active { 14 + background-image: url(/rsrc/image/phrequent_active.png); 15 + } 16 + 17 + .phrequent-on-stack { 18 + color: #777777; 19 + background-image: url(/rsrc/image/phrequent_inactive.png); 20 + }
webroot/rsrc/image/phrequent_active.png

This is a binary file and will not be displayed.

webroot/rsrc/image/phrequent_inactive.png

This is a binary file and will not be displayed.