@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 tooltip for full time for messages

Summary:
Fixes T8154. Now you can tell when a Conpherence was started by mousing over the date. I think this is sufficient.

This ends up cleaning up the code significantly; it used to inherit from some transaction view class and had built up lots of cludge over time. Much cleaner now.

Test Plan: moused over tooltips in both durable column and full conpherence and saw correct full dates. clicked on a timestamp in durable column and went to right place in full conpherence.

Reviewers: epriestley

Reviewed By: epriestley

Subscribers: Korvin, epriestley

Maniphest Tasks: T8154

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

+52 -89
+2 -16
src/applications/conpherence/ConpherenceTransactionRenderer.php
··· 74 74 ->setUser($user) 75 75 ->setConpherenceThread($conpherence) 76 76 ->setHandles($handles) 77 - ->setMarkupEngine($engine); 77 + ->setMarkupEngine($engine) 78 + ->setFullDisplay($full_display); 78 79 79 80 foreach ($transactions as $transaction) { 80 81 if ($previous_transaction) { ··· 96 97 } 97 98 $transaction_view = id(clone $transaction_view_template) 98 99 ->setConpherenceTransaction($transaction); 99 - if ($full_display) { 100 - $transaction_view 101 - ->setAnchor( 102 - $transaction->getID(), 103 - phabricator_time($transaction->getDateCreated(), $user)); 104 - $transaction_view->setContentSource($transaction->getContentSource()); 105 - $transaction_view->setShowImages(true); 106 - } else { 107 - $transaction_view 108 - ->setEpoch( 109 - $transaction->getDateCreated(), 110 - '/'.$conpherence->getMonogram().'#'.$transaction->getID()) 111 - ->setTimeOnly(true); 112 - $transaction_view->setShowImages(false); 113 - } 114 100 115 101 $rendered_transactions[] = $transaction_view->render(); 116 102 $previous_transaction = $transaction;
+1 -3
src/applications/conpherence/query/ConpherenceThreadSearchEngine.php
··· 227 227 continue; 228 228 } 229 229 230 - $history_href = '/'.$monogram.'#'.$xaction->getID(); 231 - 232 230 $view = id(new ConpherenceTransactionView()) 233 231 ->setUser($viewer) 234 232 ->setHandles($handles) 235 233 ->setMarkupEngine($engines[$conpherence_phid]) 236 234 ->setConpherenceThread($conpherence) 237 235 ->setConpherenceTransaction($xaction) 238 - ->setEpoch($xaction->getDateCreated(), $history_href) 236 + ->setFullDisplay(false) 239 237 ->addClass('conpherence-fulltext-result'); 240 238 241 239 if ($message['match']) {
+49 -70
src/applications/conpherence/view/ConpherenceTransactionView.php
··· 6 6 private $conpherenceTransaction; 7 7 private $handles; 8 8 private $markupEngine; 9 - private $epoch; 10 - private $epochHref; 11 - private $contentSource; 12 - private $anchorName; 13 - private $anchorText; 9 + private $fullDisplay; 14 10 private $classes = array(); 15 11 private $timeOnly; 16 - private $showImages = true; 17 12 18 13 public function setConpherenceThread(ConpherenceThread $t) { 19 14 $this->conpherenceThread = $t; ··· 52 47 return $this->markupEngine; 53 48 } 54 49 55 - public function setEpoch($epoch, $epoch_href = null) { 56 - $this->epoch = $epoch; 57 - $this->epochHref = $epoch_href; 50 + public function setFullDisplay($bool) { 51 + $this->fullDisplay = $bool; 58 52 return $this; 59 53 } 60 54 61 - public function setContentSource(PhabricatorContentSource $source) { 62 - $this->contentSource = $source; 63 - return $this; 64 - } 65 - 66 - private function getContentSource() { 67 - return $this->contentSource; 68 - } 69 - 70 - public function setAnchor($anchor_name, $anchor_text) { 71 - $this->anchorName = $anchor_name; 72 - $this->anchorText = $anchor_text; 73 - return $this; 55 + private function getFullDisplay() { 56 + return $this->fullDisplay; 74 57 } 75 58 76 59 public function addClass($class) { ··· 78 61 return $this; 79 62 } 80 63 81 - public function setTimeOnly($time) { 82 - $this->timeOnly = $time; 83 - return $this; 84 - } 85 - 86 - public function setShowImages($bool) { 87 - $this->showImages = $bool; 88 - return $this; 89 - } 90 - 91 - private function getShowImages() { 92 - return $this->showImages; 93 - } 94 - 95 64 public function render() { 96 - $user = $this->getUser(); 97 - if (!$user) { 65 + $viewer = $this->getUser(); 66 + if (!$viewer) { 98 67 throw new Exception(pht('Call setUser() before render()!')); 99 68 } 100 69 ··· 120 89 ), 121 90 phabricator_format_local_time( 122 91 $transaction->getDateCreated(), 123 - $user, 92 + $viewer, 124 93 'M jS, Y')), 125 94 )); 126 95 break; ··· 132 101 $content = $this->renderTransactionContent(); 133 102 $classes = implode(' ', $this->classes); 134 103 135 - $transaction_id = $this->anchorName ? 'anchor-'.$this->anchorName : null; 104 + $transaction_dom_id = null; 105 + if ($this->getFullDisplay()) { 106 + $transaction_dom_id = 'anchor-'.$transaction->getID(); 107 + } 136 108 137 109 $header = phutil_tag_div( 138 110 'conpherence-transaction-header grouped', ··· 142 114 'div', 143 115 array( 144 116 'class' => 'conpherence-transaction-view '.$classes, 145 - 'id' => $transaction_id, 117 + 'id' => $transaction_dom_id, 146 118 'sigil' => 'conpherence-transaction-view', 147 119 'meta' => array( 148 120 'id' => $transaction->getID(), ··· 156 128 } 157 129 158 130 private function renderTransactionInfo() { 131 + $viewer = $this->getUser(); 132 + $thread = $this->getConpherenceThread(); 133 + $transaction = $this->getConpherenceTransaction(); 159 134 $info = array(); 160 135 161 - if ($this->getContentSource()) { 136 + if ($this->getFullDisplay() && $transaction->getContentSource()) { 162 137 $content_source = id(new PhabricatorContentSourceView()) 163 - ->setContentSource($this->getContentSource()) 164 - ->setUser($this->user) 138 + ->setContentSource($transaction->getContentSource()) 139 + ->setUser($viewer) 165 140 ->render(); 166 141 if ($content_source) { 167 142 $info[] = $content_source; 168 143 } 169 144 } 170 145 171 - if ($this->epoch) { 172 - if ($this->timeOnly) { 173 - $epoch = phabricator_time($this->epoch, $this->user); 174 - } else { 175 - $epoch = phabricator_datetime($this->epoch, $this->user); 176 - } 177 - if ($this->epochHref) { 178 - $epoch = phutil_tag( 179 - 'a', 180 - array( 181 - 'href' => $this->epochHref, 182 - 'class' => 'epoch-link', 183 - ), 184 - $epoch); 185 - } 186 - $info[] = $epoch; 187 - } 188 - 189 - if ($this->anchorName) { 146 + Javelin::initBehavior('phabricator-tooltips'); 147 + $tip = phabricator_datetime($transaction->getDateCreated(), $viewer); 148 + $label = phabricator_time($transaction->getDateCreated(), $viewer); 149 + $width = 360; 150 + if ($this->getFullDisplay()) { 190 151 Javelin::initBehavior('phabricator-watch-anchor'); 191 - 192 152 $anchor = id(new PhabricatorAnchorView()) 193 - ->setAnchorName($this->anchorName) 153 + ->setAnchorName($transaction->getID()) 194 154 ->render(); 195 155 196 156 $info[] = hsprintf( 197 157 '%s%s', 198 158 $anchor, 199 - phutil_tag( 159 + javelin_tag( 200 160 'a', 201 161 array( 202 - 'href' => '#'.$this->anchorName, 162 + 'href' => '#'.$transaction->getID(), 203 163 'class' => 'anchor-link', 164 + 'sigil' => 'has-tooltip', 165 + 'meta' => array( 166 + 'tip' => $tip, 167 + 'size' => $width, 168 + ), 204 169 ), 205 - $this->anchorText)); 170 + $label)); 171 + } else { 172 + $href = '/'.$thread->getMonogram().'#'.$transaction->getID(); 173 + $info[] = javelin_tag( 174 + 'a', 175 + array( 176 + 'href' => $href, 177 + 'class' => 'epoch-link', 178 + 'sigil' => 'has-tooltip', 179 + 'meta' => array( 180 + 'tip' => $tip, 181 + 'size' => $width, 182 + ), 183 + ), 184 + $label); 206 185 } 207 186 208 187 $info = phutil_implode_html(" \xC2\xB7 ", $info); ··· 234 213 235 214 private function renderTransactionImage() { 236 215 $image = null; 237 - if ($this->getShowImages()) { 216 + if ($this->getFullDisplay()) { 238 217 $transaction = $this->getConpherenceTransaction(); 239 218 switch ($transaction->getTransactionType()) { 240 219 case PhabricatorTransactions::TYPE_COMMENT: ··· 282 261 $comment, 283 262 PhabricatorApplicationTransactionComment::MARKUP_FIELD_COMMENT); 284 263 $content_class = 'conpherence-message'; 285 - break; 264 + break; 286 265 } 287 266 288 267 $this->appendChild(