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

Improve rendering of Conpherence fulltext search results

Summary:
Ref T3165. This:

- Fixes a bug with overlapping matches.
- Makes the UI a little less hideous (and more standard).
- Links comments into the chat history view.

Test Plan: {F396749}

Reviewers: chad, btrahan

Reviewed By: btrahan

Subscribers: epriestley

Maniphest Tasks: T3165

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

+75 -37
+7 -5
resources/celerity/map.php
··· 7 7 */ 8 8 return array( 9 9 'names' => array( 10 - 'core.pkg.css' => 'ca3f6a60', 10 + 'core.pkg.css' => 'a821cfc9', 11 11 'core.pkg.js' => '919c56b5', 12 12 'darkconsole.pkg.js' => 'e7393ebb', 13 13 'differential.pkg.css' => 'bb338e4b', ··· 49 49 'rsrc/css/application/conpherence/menu.css' => 'f389e048', 50 50 'rsrc/css/application/conpherence/message-pane.css' => '3150e2a2', 51 51 'rsrc/css/application/conpherence/notification.css' => 'd208f806', 52 - 'rsrc/css/application/conpherence/transaction.css' => '25138b7f', 52 + 'rsrc/css/application/conpherence/transaction.css' => '885433f0', 53 53 'rsrc/css/application/conpherence/update.css' => '1099a660', 54 54 'rsrc/css/application/conpherence/widget-pane.css' => '2af42ebe', 55 55 'rsrc/css/application/contentsource/content-source-view.css' => '4b8b05d4', ··· 133 133 'rsrc/css/phui/phui-document.css' => '94d5dcd8', 134 134 'rsrc/css/phui/phui-feed-story.css' => 'c9f3a0b5', 135 135 'rsrc/css/phui/phui-fontkit.css' => 'dd8ddf27', 136 - 'rsrc/css/phui/phui-form-view.css' => '17eace76', 136 + 'rsrc/css/phui/phui-form-view.css' => '94ae3032', 137 137 'rsrc/css/phui/phui-form.css' => 'f535f938', 138 138 'rsrc/css/phui/phui-header-view.css' => 'da4586b1', 139 139 'rsrc/css/phui/phui-icon.css' => 'bc766998', ··· 346 346 'rsrc/js/application/aphlict/behavior-aphlict-listen.js' => 'b1a59974', 347 347 'rsrc/js/application/aphlict/behavior-aphlict-status.js' => 'ea681761', 348 348 'rsrc/js/application/auth/behavior-persona-login.js' => '9414ff18', 349 + 'rsrc/js/application/calendar/event-all-day.js' => 'ca5fa62a', 349 350 'rsrc/js/application/config/behavior-reorder-fields.js' => '14a827de', 350 351 'rsrc/js/application/conpherence/ConpherenceThreadManager.js' => '9e507b59', 351 352 'rsrc/js/application/conpherence/behavior-drag-and-drop-photo.js' => 'cf86d16a', ··· 516 517 'conpherence-message-pane-css' => '3150e2a2', 517 518 'conpherence-notification-css' => 'd208f806', 518 519 'conpherence-thread-manager' => '9e507b59', 519 - 'conpherence-transaction-css' => '25138b7f', 520 + 'conpherence-transaction-css' => '885433f0', 520 521 'conpherence-update-css' => '1099a660', 521 522 'conpherence-widget-pane-css' => '2af42ebe', 522 523 'differential-changeset-view-css' => 'e19cfd6e', ··· 585 586 'javelin-behavior-doorkeeper-tag' => 'e5822781', 586 587 'javelin-behavior-durable-column' => '657c2b50', 587 588 'javelin-behavior-error-log' => '6882e80a', 589 + 'javelin-behavior-event-all-day' => 'ca5fa62a', 588 590 'javelin-behavior-fancy-datepicker' => '5c0f680f', 589 591 'javelin-behavior-global-drag-and-drop' => 'c8e57404', 590 592 'javelin-behavior-herald-rule-editor' => '7ebaeed3', ··· 784 786 'phui-font-icon-base-css' => '3dad2ae3', 785 787 'phui-fontkit-css' => 'dd8ddf27', 786 788 'phui-form-css' => 'f535f938', 787 - 'phui-form-view-css' => '17eace76', 789 + 'phui-form-view-css' => '94ae3032', 788 790 'phui-header-view-css' => 'da4586b1', 789 791 'phui-icon-view-css' => 'bc766998', 790 792 'phui-image-mask-css' => '5a8b09c8',
+49 -32
src/applications/conpherence/query/ConpherenceThreadSearchEngine.php
··· 149 149 $viewer, 150 150 $conpherences); 151 151 152 + $engines = array(); 153 + 152 154 $fulltext = $query->getParameter('fulltext'); 153 155 if (strlen($fulltext) && $conpherences) { 154 156 $context = $this->loadContextMessages($conpherences, $fulltext); 155 157 156 158 $author_phids = array(); 157 - foreach ($context as $messages) { 159 + foreach ($context as $phid => $messages) { 160 + $conpherence = $conpherences[$phid]; 161 + 162 + $engine = id(new PhabricatorMarkupEngine()) 163 + ->setViewer($viewer) 164 + ->setContextObject($conpherence); 165 + 158 166 foreach ($messages as $group) { 159 167 foreach ($group as $message) { 160 168 $xaction = $message['xaction']; 161 169 if ($xaction) { 162 170 $author_phids[] = $xaction->getAuthorPHID(); 171 + $engine->addObject( 172 + $xaction->getComment(), 173 + PhabricatorApplicationTransactionComment::MARKUP_FIELD_COMMENT); 163 174 } 164 175 } 165 176 } 177 + $engine->process(); 178 + 179 + $engines[$phid] = $engine; 166 180 } 167 181 168 182 $handles = $viewer->loadHandles($author_phids); 183 + $handles = iterator_to_array($handles); 169 184 } else { 170 185 $context = array(); 171 186 } 172 187 173 188 $list = new PHUIObjectItemListView(); 174 189 $list->setUser($viewer); 175 - foreach ($conpherences as $conpherence) { 190 + foreach ($conpherences as $conpherence_phid => $conpherence) { 176 191 $created = phabricator_date($conpherence->getDateCreated(), $viewer); 177 192 $title = $conpherence->getDisplayTitle($viewer); 193 + $monogram = $conpherence->getMonogram(); 178 194 179 195 if ($conpherence->getIsRoom()) { 180 196 $icon_name = $conpherence->getPolicyIconName($policy_objects); ··· 186 202 $item = id(new PHUIObjectItemView()) 187 203 ->setObjectName($conpherence->getMonogram()) 188 204 ->setHeader($title) 189 - ->setHref('/conpherence/'.$conpherence->getID().'/') 205 + ->setHref('/'.$conpherence->getMonogram()) 190 206 ->setObject($conpherence) 191 207 ->addIcon('none', $created) 192 208 ->addIcon( ··· 201 217 phabricator_datetime($conpherence->getDateModified(), $viewer)), 202 218 )); 203 219 204 - $messages = idx($context, $conpherence->getPHID()); 220 + $messages = idx($context, $conpherence_phid); 205 221 if ($messages) { 206 - 207 - // TODO: This is egregiously under-designed. 208 - 209 222 foreach ($messages as $group) { 210 223 $rows = array(); 211 - $rowc = array(); 212 224 foreach ($group as $message) { 213 225 $xaction = $message['xaction']; 214 226 if (!$xaction) { 215 227 continue; 216 228 } 217 229 218 - $rowc[] = ($message['match'] ? 'highlighted' : null); 219 - $rows[] = array( 220 - $handles->renderHandle($xaction->getAuthorPHID()), 221 - $xaction->getComment()->getContent(), 222 - phabricator_datetime($xaction->getDateCreated(), $viewer), 223 - ); 230 + $history_href = '/'.$monogram.'#'.$xaction->getID(); 231 + 232 + $view = id(new ConpherenceTransactionView()) 233 + ->setUser($viewer) 234 + ->setHandles($handles) 235 + ->setMarkupEngine($engines[$conpherence_phid]) 236 + ->setConpherenceThread($conpherence) 237 + ->setConpherenceTransaction($xaction) 238 + ->setEpoch($xaction->getDateCreated(), $history_href) 239 + ->addClass('conpherence-fulltext-result'); 240 + 241 + if ($message['match']) { 242 + $view->addClass('conpherence-fulltext-match'); 243 + } 244 + 245 + $rows[] = $view; 224 246 } 225 - $table = id(new AphrontTableView($rows)) 226 - ->setHeaders( 227 - array( 228 - pht('User'), 229 - pht('Message'), 230 - pht('At'), 231 - )) 232 - ->setRowClasses($rowc) 233 - ->setColumnClasses( 234 - array( 235 - '', 236 - 'wide', 237 - )); 247 + 238 248 $box = id(new PHUIBoxView()) 239 - ->appendChild($table) 240 - ->addMargin(PHUI::MARGIN_SMALL); 249 + ->appendChild($rows) 250 + ->addClass('conpherence-fulltext-results'); 241 251 $item->appendChild($box); 242 252 } 243 253 } ··· 362 372 $groups = array(); 363 373 foreach ($hits as $thread_phid => $rows) { 364 374 $rows = ipull($rows, null, 'transactionPHID'); 375 + $done = array(); 365 376 foreach ($rows as $phid => $row) { 366 - unset($rows[$phid]); 377 + if (isset($done[$phid])) { 378 + continue; 379 + } 380 + $done[$phid] = true; 367 381 368 382 $group = array(); 369 383 ··· 381 395 382 396 if (isset($rows[$prev])) { 383 397 $match = true; 384 - unset($rows[$prev]); 398 + $done[$prev] = true; 385 399 } else { 386 400 $match = false; 387 401 } ··· 411 425 412 426 if (isset($rows[$next])) { 413 427 $match = true; 414 - unset($rows[$next]); 428 + $done[$next] = true; 415 429 } else { 416 430 $match = false; 417 431 } ··· 451 465 foreach ($group as $key => $list) { 452 466 foreach ($list as $lkey => $item) { 453 467 $xaction = idx($xactions, $item['phid']); 468 + if ($xaction->shouldHide()) { 469 + continue; 470 + } 454 471 $groups[$thread_phid][$key][$lkey]['xaction'] = $xaction; 455 472 } 456 473 }
+19
webroot/rsrc/css/application/conpherence/transaction.css
··· 25 25 color: {$darkbluetext}; 26 26 font-weight: bold; 27 27 } 28 + 29 + .conpherence-fulltext-results { 30 + margin: 0 8px 8px; 31 + background: {$lightgreybackground}; 32 + border: 1px solid {$lightgreyborder}; 33 + } 34 + 35 + .conpherence-fulltext-result { 36 + margin: 0 0 1px; 37 + padding: 8px; 38 + } 39 + 40 + .conpherence-fulltext-match { 41 + background: {$lightyellow}; 42 + } 43 + 44 + .conpherence-fulltext-results .epoch-link { 45 + float: right; 46 + }