Skip to content

Commit 49165bc

Browse files
Chad Littlechad
Chad Little
authored and
chad
committed
New UI for fulltext message search
Summary: Basically all here, but still probably needs some polish (links to jump? full dates?). Looks much better, still duplicates messages though sometimes. Needs to debug that more. Test Plan: Revisit search UI inside Conpherence, outside Conpherence, and normal room searches in Conpherence. {F1870748} {F1870749} {F1870750} Reviewers: epriestley Reviewed By: epriestley Subscribers: Korvin Differential Revision: https://secure.phabricator.com/D16708
1 parent 52dd354 commit 49165bc

File tree

6 files changed

+149
-112
lines changed

6 files changed

+149
-112
lines changed

resources/celerity/map.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*/
88
return array(
99
'names' => array(
10-
'conpherence.pkg.css' => '823b1104',
10+
'conpherence.pkg.css' => 'f934296b',
1111
'conpherence.pkg.js' => 'cbe4d9be',
1212
'core.pkg.css' => 'b99bbf5e',
1313
'core.pkg.js' => '30185d95',
@@ -49,10 +49,10 @@
4949
'rsrc/css/application/conpherence/durable-column.css' => '44bcaa19',
5050
'rsrc/css/application/conpherence/header-pane.css' => 'e8acbd37',
5151
'rsrc/css/application/conpherence/menu.css' => '4f51db5a',
52-
'rsrc/css/application/conpherence/message-pane.css' => '4db388a6',
52+
'rsrc/css/application/conpherence/message-pane.css' => '7a94bf5e',
5353
'rsrc/css/application/conpherence/notification.css' => '965db05b',
5454
'rsrc/css/application/conpherence/participant-pane.css' => '7bba0b56',
55-
'rsrc/css/application/conpherence/transaction.css' => '46253e19',
55+
'rsrc/css/application/conpherence/transaction.css' => '85129c68',
5656
'rsrc/css/application/contentsource/content-source-view.css' => '4b8b05d4',
5757
'rsrc/css/application/countdown/timer.css' => '16c52f5c',
5858
'rsrc/css/application/daemon/bulk-job.css' => 'df9c1d4a',
@@ -619,11 +619,11 @@
619619
'conpherence-durable-column-view' => '44bcaa19',
620620
'conpherence-header-pane-css' => 'e8acbd37',
621621
'conpherence-menu-css' => '4f51db5a',
622-
'conpherence-message-pane-css' => '4db388a6',
622+
'conpherence-message-pane-css' => '7a94bf5e',
623623
'conpherence-notification-css' => '965db05b',
624624
'conpherence-participant-pane-css' => '7bba0b56',
625625
'conpherence-thread-manager' => '01774ab2',
626-
'conpherence-transaction-css' => '46253e19',
626+
'conpherence-transaction-css' => '85129c68',
627627
'd3' => 'a11a5ff2',
628628
'differential-changeset-view-css' => '9ef7d354',
629629
'differential-core-view-css' => '5b7b8ff4',

src/applications/conpherence/controller/ConpherenceThreadSearchController.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,6 @@ public function handleRequest(AphrontRequest $request) {
3636
$view = $engine->renderResults($results, $saved);
3737

3838
return id(new AphrontAjaxResponse())
39-
->setContent($view->getObjectList());
39+
->setContent($view->getContent());
4040
}
4141
}

src/applications/conpherence/query/ConpherenceThreadSearchEngine.php

Lines changed: 70 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@ public function getApplicationClassName() {
1313

1414
public function newQuery() {
1515
return id(new ConpherenceThreadQuery())
16-
->needParticipantCache(true);
16+
->needParticipantCache(true)
17+
->needProfileImage(true);
1718
}
1819

1920
protected function buildCustomSearchFields() {
@@ -147,6 +148,7 @@ protected function renderResultList(
147148
$context = array();
148149
}
149150

151+
$content = array();
150152
$list = new PHUIObjectItemListView();
151153
$list->setUser($viewer);
152154
foreach ($conpherences as $conpherence_phid => $conpherence) {
@@ -157,63 +159,82 @@ protected function renderResultList(
157159
$icon_name = $conpherence->getPolicyIconName($policy_objects);
158160
$icon = id(new PHUIIconView())
159161
->setIcon($icon_name);
160-
$item = id(new PHUIObjectItemView())
161-
->setObjectName($conpherence->getMonogram())
162-
->setHeader($title)
163-
->setHref('/'.$conpherence->getMonogram())
164-
->setObject($conpherence)
165-
->addIcon('none', $created)
166-
->addIcon(
167-
'none',
168-
pht('Messages: %d', $conpherence->getMessageCount()))
169-
->addAttribute(
170-
array(
171-
$icon,
172-
' ',
173-
pht(
174-
'Last updated %s',
175-
phabricator_datetime($conpherence->getDateModified(), $viewer)),
176-
));
177-
178-
$messages = idx($context, $conpherence_phid);
179-
if ($messages) {
180-
foreach ($messages as $group) {
181-
$rows = array();
182-
foreach ($group as $message) {
183-
$xaction = $message['xaction'];
184-
if (!$xaction) {
185-
continue;
186-
}
187162

188-
$view = id(new ConpherenceTransactionView())
189-
->setUser($viewer)
190-
->setHandles($handles)
191-
->setMarkupEngine($engines[$conpherence_phid])
192-
->setConpherenceThread($conpherence)
193-
->setConpherenceTransaction($xaction)
194-
->setFullDisplay(false)
195-
->addClass('conpherence-fulltext-result');
196-
197-
if ($message['match']) {
198-
$view->addClass('conpherence-fulltext-match');
163+
if (!strlen($fulltext)) {
164+
$item = id(new PHUIObjectItemView())
165+
->setObjectName($conpherence->getMonogram())
166+
->setHeader($title)
167+
->setHref('/'.$conpherence->getMonogram())
168+
->setObject($conpherence)
169+
->setImageURI($conpherence->getProfileImageURI())
170+
->addIcon('none', $created)
171+
->addIcon(
172+
'none',
173+
pht('Messages: %d', $conpherence->getMessageCount()))
174+
->addAttribute(
175+
array(
176+
$icon,
177+
' ',
178+
pht(
179+
'Last updated %s',
180+
phabricator_datetime($conpherence->getDateModified(), $viewer)),
181+
));
182+
$list->addItem($item);
183+
} else {
184+
$messages = idx($context, $conpherence_phid);
185+
$box = array();
186+
$list = null;
187+
if ($messages) {
188+
foreach ($messages as $group) {
189+
$rows = array();
190+
foreach ($group as $message) {
191+
$xaction = $message['xaction'];
192+
if (!$xaction) {
193+
continue;
194+
}
195+
196+
$view = id(new ConpherenceTransactionView())
197+
->setUser($viewer)
198+
->setHandles($handles)
199+
->setMarkupEngine($engines[$conpherence_phid])
200+
->setConpherenceThread($conpherence)
201+
->setConpherenceTransaction($xaction)
202+
->setFullDisplay(true)
203+
->addClass('conpherence-fulltext-result');
204+
205+
if ($message['match']) {
206+
$view->addClass('conpherence-fulltext-match');
207+
}
208+
209+
$rows[] = $view;
199210
}
200-
201-
$rows[] = $view;
211+
$box[] = id(new PHUIBoxView())
212+
->appendChild($rows)
213+
->addClass('conpherence-fulltext-results');
202214
}
203-
204-
$box = id(new PHUIBoxView())
205-
->appendChild($rows)
206-
->addClass('conpherence-fulltext-results');
207-
$item->appendChild($box);
208215
}
216+
$header = id(new PHUIHeaderView())
217+
->setHeader($title)
218+
->setHeaderIcon($icon_name)
219+
->setHref('/'.$monogram);
220+
221+
$content[] = id(new PHUIObjectBoxView())
222+
->setHeader($header)
223+
->appendChild($box);
209224
}
225+
}
210226

211-
$list->addItem($item);
227+
if ($list) {
228+
$content = $list;
229+
} else {
230+
$content = id(new PHUIBoxView())
231+
->addClass('conpherence-search-room-results')
232+
->appendChild($content);
212233
}
213234

214235
$result = new PhabricatorApplicationSearchResultView();
215-
$result->setObjectList($list);
216-
$result->setNoDataString(pht('No threads found.'));
236+
$result->setContent($content);
237+
$result->setNoDataString(pht('No results found.'));
217238

218239
return $result;
219240
}

src/applications/conpherence/view/ConpherenceTransactionView.php

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -247,17 +247,14 @@ private function renderTransactionContent() {
247247
break;
248248
}
249249

250-
$this->appendChild(
251-
phutil_tag(
252-
'div',
253-
array(
254-
'class' => $content_class,
255-
),
256-
$content));
250+
$view = phutil_tag(
251+
'div',
252+
array(
253+
'class' => $content_class,
254+
),
255+
$content);
257256

258-
return phutil_tag_div(
259-
'conpherence-transaction-content',
260-
$this->renderChildren());
257+
return phutil_tag_div('conpherence-transaction-content', $view);
261258
}
262259

263260
}

0 commit comments

Comments
 (0)