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

Add setEpoch for PHUIHeaderView, use in all Documents

Summary: Sets a consistent last update time in the header of PHUIDocuments, Legalpad, Diviner, Phriction. I'm not set on the exact language, just that there is consistency, feel free to suggest changes.

Test Plan:
Test Legalpad, Diviner, Phriction.

{F368270}

Reviewers: btrahan, epriestley

Reviewed By: epriestley

Subscribers: Korvin, epriestley

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

+23 -33
+2 -21
src/applications/diviner/controller/DivinerBookController.php
··· 35 35 $header = id(new PHUIHeaderView()) 36 36 ->setHeader($book->getTitle()) 37 37 ->setUser($viewer) 38 - ->setPolicyObject($book); 38 + ->setPolicyObject($book) 39 + ->setEpoch($book->getDateModified()); 39 40 40 41 $document = new PHUIDocumentView(); 41 42 $document->setHeader($header); 42 43 $document->addClass('diviner-view'); 43 - 44 44 $document->setFontKit(PHUIDocumentView::FONT_SOURCE_SANS); 45 - 46 - $properties = $this->buildPropertyList($book); 47 45 48 46 $atoms = id(new DivinerAtomQuery()) 49 47 ->setViewer($viewer) ··· 87 85 $viewer); 88 86 } 89 87 90 - $document->appendChild($properties); 91 88 $document->appendChild($preface_view); 92 89 $document->appendChild($out); 93 90 ··· 99 96 array( 100 97 'title' => $book->getTitle(), 101 98 )); 102 - } 103 - 104 - private function buildPropertyList(DivinerLiveBook $book) { 105 - $viewer = $this->getRequest()->getUser(); 106 - $view = id(new PHUIPropertyListView()) 107 - ->setUser($viewer); 108 - 109 - $policies = PhabricatorPolicyQuery::renderPolicyDescriptions( 110 - $viewer, 111 - $book); 112 - 113 - $view->addProperty( 114 - pht('Updated'), 115 - phabricator_datetime($book->getDateModified(), $viewer)); 116 - 117 - return $view; 118 99 } 119 100 120 101 }
+3
src/applications/legalpad/controller/LegalpadDocumentSignController.php
··· 232 232 233 233 $header = id(new PHUIHeaderView()) 234 234 ->setHeader($title) 235 + ->setUser($viewer) 236 + ->setPolicyObject($document) 237 + ->setEpoch($document->getDateModified()) 235 238 ->addActionLink( 236 239 id(new PHUIButtonView()) 237 240 ->setTag('a')
+2 -12
src/applications/phriction/controller/PhrictionDocumentController.php
··· 194 194 $header = id(new PHUIHeaderView()) 195 195 ->setUser($user) 196 196 ->setPolicyObject($document) 197 - ->setHeader($page_title); 197 + ->setHeader($page_title) 198 + ->setEpoch($content->getDateCreated()); 198 199 199 200 $prop_list = null; 200 201 if ($properties) { ··· 243 244 $view->addProperty( 244 245 pht('Last Author'), 245 246 $viewer->renderHandle($content->getAuthorPHID())); 246 - 247 - $age = time() - $content->getDateCreated(); 248 - $age = floor($age / (60 * 60 * 24)); 249 - if ($age < 1) { 250 - $when = pht('Today'); 251 - } else if ($age == 1) { 252 - $when = pht('Yesterday'); 253 - } else { 254 - $when = pht('%d Days Ago', $age); 255 - } 256 - $view->addProperty(pht('Last Updated'), $when); 257 247 258 248 return $view; 259 249 }
+16
src/view/phui/PHUIHeaderView.php
··· 17 17 private $actionLinks = array(); 18 18 private $buttonBar = null; 19 19 private $policyObject; 20 + private $epoch; 20 21 21 22 public function setHeader($header) { 22 23 $this->header = $header; ··· 105 106 )); 106 107 107 108 return $this->addProperty(self::PROPERTY_STATUS, $tag); 109 + } 110 + 111 + public function setEpoch($epoch) { 112 + $age = time() - $epoch; 113 + $age = floor($age / (60 * 60 * 24)); 114 + if ($age < 1) { 115 + $when = pht('Today'); 116 + } else if ($age == 1) { 117 + $when = pht('Yesterday'); 118 + } else { 119 + $when = pht('%d Days Ago', $age); 120 + } 121 + 122 + $this->setStatus('fa-clock-o bluegrey', null, pht('Updated %s', $when)); 123 + return $this; 108 124 } 109 125 110 126 public function render() {