mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-30 02:32:42 +01:00
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
This commit is contained in:
parent
22ac7d7c76
commit
188c21ae08
3 changed files with 75 additions and 37 deletions
|
@ -7,7 +7,7 @@
|
|||
*/
|
||||
return array(
|
||||
'names' => array(
|
||||
'core.pkg.css' => 'ca3f6a60',
|
||||
'core.pkg.css' => 'a821cfc9',
|
||||
'core.pkg.js' => '919c56b5',
|
||||
'darkconsole.pkg.js' => 'e7393ebb',
|
||||
'differential.pkg.css' => 'bb338e4b',
|
||||
|
@ -49,7 +49,7 @@ return array(
|
|||
'rsrc/css/application/conpherence/menu.css' => 'f389e048',
|
||||
'rsrc/css/application/conpherence/message-pane.css' => '3150e2a2',
|
||||
'rsrc/css/application/conpherence/notification.css' => 'd208f806',
|
||||
'rsrc/css/application/conpherence/transaction.css' => '25138b7f',
|
||||
'rsrc/css/application/conpherence/transaction.css' => '885433f0',
|
||||
'rsrc/css/application/conpherence/update.css' => '1099a660',
|
||||
'rsrc/css/application/conpherence/widget-pane.css' => '2af42ebe',
|
||||
'rsrc/css/application/contentsource/content-source-view.css' => '4b8b05d4',
|
||||
|
@ -133,7 +133,7 @@ return array(
|
|||
'rsrc/css/phui/phui-document.css' => '94d5dcd8',
|
||||
'rsrc/css/phui/phui-feed-story.css' => 'c9f3a0b5',
|
||||
'rsrc/css/phui/phui-fontkit.css' => 'dd8ddf27',
|
||||
'rsrc/css/phui/phui-form-view.css' => '17eace76',
|
||||
'rsrc/css/phui/phui-form-view.css' => '94ae3032',
|
||||
'rsrc/css/phui/phui-form.css' => 'f535f938',
|
||||
'rsrc/css/phui/phui-header-view.css' => 'da4586b1',
|
||||
'rsrc/css/phui/phui-icon.css' => 'bc766998',
|
||||
|
@ -346,6 +346,7 @@ return array(
|
|||
'rsrc/js/application/aphlict/behavior-aphlict-listen.js' => 'b1a59974',
|
||||
'rsrc/js/application/aphlict/behavior-aphlict-status.js' => 'ea681761',
|
||||
'rsrc/js/application/auth/behavior-persona-login.js' => '9414ff18',
|
||||
'rsrc/js/application/calendar/event-all-day.js' => 'ca5fa62a',
|
||||
'rsrc/js/application/config/behavior-reorder-fields.js' => '14a827de',
|
||||
'rsrc/js/application/conpherence/ConpherenceThreadManager.js' => '9e507b59',
|
||||
'rsrc/js/application/conpherence/behavior-drag-and-drop-photo.js' => 'cf86d16a',
|
||||
|
@ -516,7 +517,7 @@ return array(
|
|||
'conpherence-message-pane-css' => '3150e2a2',
|
||||
'conpherence-notification-css' => 'd208f806',
|
||||
'conpherence-thread-manager' => '9e507b59',
|
||||
'conpherence-transaction-css' => '25138b7f',
|
||||
'conpherence-transaction-css' => '885433f0',
|
||||
'conpherence-update-css' => '1099a660',
|
||||
'conpherence-widget-pane-css' => '2af42ebe',
|
||||
'differential-changeset-view-css' => 'e19cfd6e',
|
||||
|
@ -585,6 +586,7 @@ return array(
|
|||
'javelin-behavior-doorkeeper-tag' => 'e5822781',
|
||||
'javelin-behavior-durable-column' => '657c2b50',
|
||||
'javelin-behavior-error-log' => '6882e80a',
|
||||
'javelin-behavior-event-all-day' => 'ca5fa62a',
|
||||
'javelin-behavior-fancy-datepicker' => '5c0f680f',
|
||||
'javelin-behavior-global-drag-and-drop' => 'c8e57404',
|
||||
'javelin-behavior-herald-rule-editor' => '7ebaeed3',
|
||||
|
@ -784,7 +786,7 @@ return array(
|
|||
'phui-font-icon-base-css' => '3dad2ae3',
|
||||
'phui-fontkit-css' => 'dd8ddf27',
|
||||
'phui-form-css' => 'f535f938',
|
||||
'phui-form-view-css' => '17eace76',
|
||||
'phui-form-view-css' => '94ae3032',
|
||||
'phui-header-view-css' => 'da4586b1',
|
||||
'phui-icon-view-css' => 'bc766998',
|
||||
'phui-image-mask-css' => '5a8b09c8',
|
||||
|
|
|
@ -149,32 +149,48 @@ final class ConpherenceThreadSearchEngine
|
|||
$viewer,
|
||||
$conpherences);
|
||||
|
||||
$engines = array();
|
||||
|
||||
$fulltext = $query->getParameter('fulltext');
|
||||
if (strlen($fulltext) && $conpherences) {
|
||||
$context = $this->loadContextMessages($conpherences, $fulltext);
|
||||
|
||||
$author_phids = array();
|
||||
foreach ($context as $messages) {
|
||||
foreach ($context as $phid => $messages) {
|
||||
$conpherence = $conpherences[$phid];
|
||||
|
||||
$engine = id(new PhabricatorMarkupEngine())
|
||||
->setViewer($viewer)
|
||||
->setContextObject($conpherence);
|
||||
|
||||
foreach ($messages as $group) {
|
||||
foreach ($group as $message) {
|
||||
$xaction = $message['xaction'];
|
||||
if ($xaction) {
|
||||
$author_phids[] = $xaction->getAuthorPHID();
|
||||
$engine->addObject(
|
||||
$xaction->getComment(),
|
||||
PhabricatorApplicationTransactionComment::MARKUP_FIELD_COMMENT);
|
||||
}
|
||||
}
|
||||
}
|
||||
$engine->process();
|
||||
|
||||
$engines[$phid] = $engine;
|
||||
}
|
||||
|
||||
$handles = $viewer->loadHandles($author_phids);
|
||||
$handles = iterator_to_array($handles);
|
||||
} else {
|
||||
$context = array();
|
||||
}
|
||||
|
||||
$list = new PHUIObjectItemListView();
|
||||
$list->setUser($viewer);
|
||||
foreach ($conpherences as $conpherence) {
|
||||
foreach ($conpherences as $conpherence_phid => $conpherence) {
|
||||
$created = phabricator_date($conpherence->getDateCreated(), $viewer);
|
||||
$title = $conpherence->getDisplayTitle($viewer);
|
||||
$monogram = $conpherence->getMonogram();
|
||||
|
||||
if ($conpherence->getIsRoom()) {
|
||||
$icon_name = $conpherence->getPolicyIconName($policy_objects);
|
||||
|
@ -186,7 +202,7 @@ final class ConpherenceThreadSearchEngine
|
|||
$item = id(new PHUIObjectItemView())
|
||||
->setObjectName($conpherence->getMonogram())
|
||||
->setHeader($title)
|
||||
->setHref('/conpherence/'.$conpherence->getID().'/')
|
||||
->setHref('/'.$conpherence->getMonogram())
|
||||
->setObject($conpherence)
|
||||
->addIcon('none', $created)
|
||||
->addIcon(
|
||||
|
@ -201,43 +217,37 @@ final class ConpherenceThreadSearchEngine
|
|||
phabricator_datetime($conpherence->getDateModified(), $viewer)),
|
||||
));
|
||||
|
||||
$messages = idx($context, $conpherence->getPHID());
|
||||
$messages = idx($context, $conpherence_phid);
|
||||
if ($messages) {
|
||||
|
||||
// TODO: This is egregiously under-designed.
|
||||
|
||||
foreach ($messages as $group) {
|
||||
$rows = array();
|
||||
$rowc = array();
|
||||
foreach ($group as $message) {
|
||||
$xaction = $message['xaction'];
|
||||
if (!$xaction) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$rowc[] = ($message['match'] ? 'highlighted' : null);
|
||||
$rows[] = array(
|
||||
$handles->renderHandle($xaction->getAuthorPHID()),
|
||||
$xaction->getComment()->getContent(),
|
||||
phabricator_datetime($xaction->getDateCreated(), $viewer),
|
||||
);
|
||||
$history_href = '/'.$monogram.'#'.$xaction->getID();
|
||||
|
||||
$view = id(new ConpherenceTransactionView())
|
||||
->setUser($viewer)
|
||||
->setHandles($handles)
|
||||
->setMarkupEngine($engines[$conpherence_phid])
|
||||
->setConpherenceThread($conpherence)
|
||||
->setConpherenceTransaction($xaction)
|
||||
->setEpoch($xaction->getDateCreated(), $history_href)
|
||||
->addClass('conpherence-fulltext-result');
|
||||
|
||||
if ($message['match']) {
|
||||
$view->addClass('conpherence-fulltext-match');
|
||||
}
|
||||
|
||||
$rows[] = $view;
|
||||
}
|
||||
$table = id(new AphrontTableView($rows))
|
||||
->setHeaders(
|
||||
array(
|
||||
pht('User'),
|
||||
pht('Message'),
|
||||
pht('At'),
|
||||
))
|
||||
->setRowClasses($rowc)
|
||||
->setColumnClasses(
|
||||
array(
|
||||
'',
|
||||
'wide',
|
||||
));
|
||||
|
||||
$box = id(new PHUIBoxView())
|
||||
->appendChild($table)
|
||||
->addMargin(PHUI::MARGIN_SMALL);
|
||||
->appendChild($rows)
|
||||
->addClass('conpherence-fulltext-results');
|
||||
$item->appendChild($box);
|
||||
}
|
||||
}
|
||||
|
@ -362,8 +372,12 @@ final class ConpherenceThreadSearchEngine
|
|||
$groups = array();
|
||||
foreach ($hits as $thread_phid => $rows) {
|
||||
$rows = ipull($rows, null, 'transactionPHID');
|
||||
$done = array();
|
||||
foreach ($rows as $phid => $row) {
|
||||
unset($rows[$phid]);
|
||||
if (isset($done[$phid])) {
|
||||
continue;
|
||||
}
|
||||
$done[$phid] = true;
|
||||
|
||||
$group = array();
|
||||
|
||||
|
@ -381,7 +395,7 @@ final class ConpherenceThreadSearchEngine
|
|||
|
||||
if (isset($rows[$prev])) {
|
||||
$match = true;
|
||||
unset($rows[$prev]);
|
||||
$done[$prev] = true;
|
||||
} else {
|
||||
$match = false;
|
||||
}
|
||||
|
@ -411,7 +425,7 @@ final class ConpherenceThreadSearchEngine
|
|||
|
||||
if (isset($rows[$next])) {
|
||||
$match = true;
|
||||
unset($rows[$next]);
|
||||
$done[$next] = true;
|
||||
} else {
|
||||
$match = false;
|
||||
}
|
||||
|
@ -451,6 +465,9 @@ final class ConpherenceThreadSearchEngine
|
|||
foreach ($group as $key => $list) {
|
||||
foreach ($list as $lkey => $item) {
|
||||
$xaction = idx($xactions, $item['phid']);
|
||||
if ($xaction->shouldHide()) {
|
||||
continue;
|
||||
}
|
||||
$groups[$thread_phid][$key][$lkey]['xaction'] = $xaction;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -25,3 +25,22 @@
|
|||
color: {$darkbluetext};
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.conpherence-fulltext-results {
|
||||
margin: 0 8px 8px;
|
||||
background: {$lightgreybackground};
|
||||
border: 1px solid {$lightgreyborder};
|
||||
}
|
||||
|
||||
.conpherence-fulltext-result {
|
||||
margin: 0 0 1px;
|
||||
padding: 8px;
|
||||
}
|
||||
|
||||
.conpherence-fulltext-match {
|
||||
background: {$lightyellow};
|
||||
}
|
||||
|
||||
.conpherence-fulltext-results .epoch-link {
|
||||
float: right;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue