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

Conpherence - add daily date dividers

Summary: nice title. Fixes T3203. If its been N days and now its Tuesday, it just shows a single marker for Tuesday.

Test Plan: Viewed a conpherence and there were date dividers!

Reviewers: epriestley, chad

Reviewed By: epriestley

CC: aran, Korvin

Maniphest Tasks: T3203

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

+71 -3
+2 -2
src/__celerity_resource_map__.php
··· 927 927 ), 928 928 'conpherence-message-pane-css' => 929 929 array( 930 - 'uri' => '/res/cbd704df/rsrc/css/application/conpherence/message-pane.css', 930 + 'uri' => '/res/3a94564a/rsrc/css/application/conpherence/message-pane.css', 931 931 'type' => 'css', 932 932 'requires' => 933 933 array( ··· 1294 1294 ), 1295 1295 'javelin-behavior-conpherence-menu' => 1296 1296 array( 1297 - 'uri' => '/res/567585ab/rsrc/js/application/conpherence/behavior-menu.js', 1297 + 'uri' => '/res/f27205d4/rsrc/js/application/conpherence/behavior-menu.js', 1298 1298 'type' => 'js', 1299 1299 'requires' => 1300 1300 array(
+1
src/applications/conpherence/constants/ConpherenceTransactionType.php
··· 8 8 const TYPE_FILES = 'files'; 9 9 const TYPE_TITLE = 'title'; 10 10 const TYPE_PARTICIPANTS = 'participants'; 11 + const TYPE_DATE_MARKER = 'date-marker'; 11 12 12 13 /* these two are deprecated but keep them around for legacy installs */ 13 14 const TYPE_PICTURE = 'picture';
+28
src/applications/conpherence/controller/ConpherenceController.php
··· 108 108 } 109 109 } 110 110 $engine->process(); 111 + // we're going to insert a dummy date marker transaction for breaks 112 + // between days. some setup required! 113 + $previous_transaction = null; 114 + $date_marker_transaction = id(new ConpherenceTransaction()) 115 + ->setTransactionType(ConpherenceTransactionType::TYPE_DATE_MARKER) 116 + ->makeEphemeral(); 117 + $date_marker_transaction_view = id(new ConpherenceTransactionView()) 118 + ->setUser($user) 119 + ->setConpherenceTransaction($date_marker_transaction) 120 + ->setHandles($handles) 121 + ->setMarkupEngine($engine); 111 122 foreach ($transactions as $transaction) { 123 + if ($previous_transaction) { 124 + $previous_day = phabricator_format_local_time( 125 + $previous_transaction->getDateCreated(), 126 + $user, 127 + 'Ymd'); 128 + $current_day = phabricator_format_local_time( 129 + $transaction->getDateCreated(), 130 + $user, 131 + 'Ymd'); 132 + // date marker transaction time! 133 + if ($previous_day != $current_day) { 134 + $date_marker_transaction->setDateCreated( 135 + $transaction->getDateCreated()); 136 + $rendered_transactions[] = $date_marker_transaction_view->render(); 137 + } 138 + } 112 139 $rendered_transactions[] = id(new ConpherenceTransactionView()) 113 140 ->setUser($user) 114 141 ->setConpherenceTransaction($transaction) 115 142 ->setHandles($handles) 116 143 ->setMarkupEngine($engine) 117 144 ->render(); 145 + $previous_transaction = $transaction; 118 146 } 119 147 $latest_transaction_id = $transaction->getID(); 120 148
+2
src/applications/conpherence/storage/ConpherenceTransaction.php
··· 39 39 case ConpherenceTransactionType::TYPE_PARTICIPANTS: 40 40 return ($old === null); 41 41 case ConpherenceTransactionType::TYPE_TITLE: 42 + case ConpherenceTransactionType::TYPE_DATE_MARKER: 42 43 return false; 43 44 case ConpherenceTransactionType::TYPE_FILES: 44 45 return true; ··· 142 143 switch ($this->getTransactionType()) { 143 144 case ConpherenceTransactionType::TYPE_TITLE: 144 145 case ConpherenceTransactionType::TYPE_FILES: 146 + case ConpherenceTransactionType::TYPE_DATE_MARKER: 145 147 break; 146 148 case ConpherenceTransactionType::TYPE_PARTICIPANTS: 147 149 $phids = array_merge($phids, $this->getOldValue());
+22 -1
src/applications/conpherence/view/ConpherenceTransactionView.php
··· 32 32 } 33 33 34 34 public function render() { 35 + $user = $this->getUser(); 35 36 $transaction = $this->getConpherenceTransaction(); 37 + switch ($transaction->getTransactionType()) { 38 + case ConpherenceTransactionType::TYPE_DATE_MARKER: 39 + return phutil_tag( 40 + 'div', 41 + array( 42 + 'class' => 'date-marker' 43 + ), 44 + array( 45 + phutil_tag( 46 + 'span', 47 + array( 48 + 'class' => 'date', 49 + ), 50 + phabricator_format_local_time( 51 + $transaction->getDateCreated(), 52 + $user, 53 + 'M jS, Y')))); 54 + break; 55 + } 56 + 36 57 $handles = $this->getHandles(); 37 58 $transaction->setHandles($handles); 38 59 $author = $handles[$transaction->getAuthorPHID()]; 39 60 $transaction_view = id(new PhabricatorTransactionView()) 40 - ->setUser($this->getUser()) 61 + ->setUser($user) 41 62 ->setEpoch($transaction->getDateCreated()) 42 63 ->setContentSource($transaction->getContentSource()); 43 64
+16
webroot/rsrc/css/application/conpherence/message-pane.css
··· 133 133 margin-left: 45px; 134 134 } 135 135 136 + .conpherence-message-pane .date-marker { 137 + border-top: 1px solid #bfbfbf; 138 + margin: 5px 15px; 139 + min-height: auto; 140 + } 141 + .conpherence-message-pane .date-marker .date { 142 + position: relative; 143 + top: -8px; 144 + left: 45px; 145 + background-color: #FFF; 146 + width: auto; 147 + color: #BFBFBF; 148 + font-size: 11px; 149 + padding: 0px 5px; 150 + } 151 + 136 152 .device-phone .conpherence-message-pane .phabricator-transaction-detail { 137 153 min-height: auto; 138 154 }