Page MenuHomePhabricator

D14095.id34070.diff
No OneTemporary

D14095.id34070.diff

diff --git a/resources/celerity/map.php b/resources/celerity/map.php
--- a/resources/celerity/map.php
+++ b/resources/celerity/map.php
@@ -11,7 +11,7 @@
'core.pkg.js' => '47dc9ebb',
'darkconsole.pkg.js' => 'e7393ebb',
'differential.pkg.css' => '2de124c9',
- 'differential.pkg.js' => '6223dd9d',
+ 'differential.pkg.js' => '52d725be',
'diffusion.pkg.css' => '385e85b3',
'diffusion.pkg.js' => '0115b37c',
'maniphest.pkg.css' => '4845691a',
@@ -99,7 +99,7 @@
'rsrc/css/application/releeph/releeph-preview-branch.css' => 'b7a6f4a5',
'rsrc/css/application/releeph/releeph-request-differential-create-dialog.css' => '8d8b92cd',
'rsrc/css/application/releeph/releeph-request-typeahead.css' => '667a48ae',
- 'rsrc/css/application/search/search-results.css' => '7dea472c',
+ 'rsrc/css/application/search/search-results.css' => '586db3a4',
'rsrc/css/application/slowvote/slowvote.css' => '475b4bd2',
'rsrc/css/application/tokens/tokens.css' => '3d0f239e',
'rsrc/css/application/uiexample/example.css' => '528b19de',
@@ -357,13 +357,13 @@
'rsrc/js/application/dashboard/behavior-dashboard-query-panel-select.js' => '453c5375',
'rsrc/js/application/dashboard/behavior-dashboard-tab-panel.js' => 'd4eecc63',
'rsrc/js/application/differential/ChangesetViewManager.js' => '58562350',
- 'rsrc/js/application/differential/DifferentialInlineCommentEditor.js' => '64a5550f',
+ 'rsrc/js/application/differential/DifferentialInlineCommentEditor.js' => 'd4c87bf4',
'rsrc/js/application/differential/behavior-add-reviewers-and-ccs.js' => 'e10f8e18',
'rsrc/js/application/differential/behavior-comment-jump.js' => '4fdb476d',
'rsrc/js/application/differential/behavior-comment-preview.js' => 'b064af76',
'rsrc/js/application/differential/behavior-diff-radios.js' => 'e1ff79b1',
'rsrc/js/application/differential/behavior-dropdown-menus.js' => '2035b9cb',
- 'rsrc/js/application/differential/behavior-edit-inline-comments.js' => '65ef6074',
+ 'rsrc/js/application/differential/behavior-edit-inline-comments.js' => '037b59eb',
'rsrc/js/application/differential/behavior-keyboard-nav.js' => '2c426492',
'rsrc/js/application/differential/behavior-populate.js' => '8694b1df',
'rsrc/js/application/differential/behavior-toggle-files.js' => 'ca3f91eb',
@@ -517,7 +517,7 @@
'conpherence-widget-pane-css' => '775eaaba',
'differential-changeset-view-css' => 'b6b0d1bb',
'differential-core-view-css' => '7ac3cabc',
- 'differential-inline-comment-editor' => '64a5550f',
+ 'differential-inline-comment-editor' => 'd4c87bf4',
'differential-revision-add-comment-css' => 'c47f8c40',
'differential-revision-comment-css' => '14b8565a',
'differential-revision-history-css' => '0e8eb855',
@@ -568,7 +568,7 @@
'javelin-behavior-differential-comment-jump' => '4fdb476d',
'javelin-behavior-differential-diff-radios' => 'e1ff79b1',
'javelin-behavior-differential-dropdown-menus' => '2035b9cb',
- 'javelin-behavior-differential-edit-inline-comments' => '65ef6074',
+ 'javelin-behavior-differential-edit-inline-comments' => '037b59eb',
'javelin-behavior-differential-feedback-preview' => 'b064af76',
'javelin-behavior-differential-keyboard-navigation' => '2c426492',
'javelin-behavior-differential-populate' => '8694b1df',
@@ -738,7 +738,7 @@
'phabricator-phtize' => 'd254d646',
'phabricator-prefab' => '6920d200',
'phabricator-remarkup-css' => '1c4ac273',
- 'phabricator-search-results-css' => '7dea472c',
+ 'phabricator-search-results-css' => '586db3a4',
'phabricator-shaped-request' => '7cbe244b',
'phabricator-side-menu-view-css' => 'bec2458e',
'phabricator-slowvote-css' => '475b4bd2',
@@ -853,6 +853,14 @@
'javelin-behavior-device',
'phabricator-title',
),
+ '037b59eb' => array(
+ 'javelin-behavior',
+ 'javelin-stratcom',
+ 'javelin-dom',
+ 'javelin-util',
+ 'javelin-vector',
+ 'differential-inline-comment-editor',
+ ),
'048330fa' => array(
'javelin-behavior',
'javelin-typeahead-ondemand-source',
@@ -1281,22 +1289,6 @@
'javelin-workflow',
'javelin-dom',
),
- '64a5550f' => array(
- 'javelin-dom',
- 'javelin-util',
- 'javelin-stratcom',
- 'javelin-install',
- 'javelin-request',
- 'javelin-workflow',
- ),
- '65ef6074' => array(
- 'javelin-behavior',
- 'javelin-stratcom',
- 'javelin-dom',
- 'javelin-util',
- 'javelin-vector',
- 'differential-inline-comment-editor',
- ),
'665cf6ac' => array(
'javelin-behavior',
'javelin-util',
@@ -1825,6 +1817,14 @@
'javelin-dom',
'javelin-view',
),
+ 'd4c87bf4' => array(
+ 'javelin-dom',
+ 'javelin-util',
+ 'javelin-stratcom',
+ 'javelin-install',
+ 'javelin-request',
+ 'javelin-workflow',
+ ),
'd4eecc63' => array(
'javelin-behavior',
'javelin-dom',
diff --git a/src/__phutil_library_map__.php b/src/__phutil_library_map__.php
--- a/src/__phutil_library_map__.php
+++ b/src/__phutil_library_map__.php
@@ -2840,6 +2840,7 @@
'PhabricatorSearchResultView' => 'applications/search/view/PhabricatorSearchResultView.php',
'PhabricatorSearchSelectController' => 'applications/search/controller/PhabricatorSearchSelectController.php',
'PhabricatorSearchSelectField' => 'applications/search/field/PhabricatorSearchSelectField.php',
+ 'PhabricatorSearchSnippetInterface' => 'applications/search/interface/PhabricatorSearchSnippetInterface.php',
'PhabricatorSearchStringListField' => 'applications/search/field/PhabricatorSearchStringListField.php',
'PhabricatorSearchSubscribersField' => 'applications/search/field/PhabricatorSearchSubscribersField.php',
'PhabricatorSearchTextField' => 'applications/search/field/PhabricatorSearchTextField.php',
@@ -4132,6 +4133,7 @@
'PhabricatorMentionableInterface',
'PhabricatorDestructibleInterface',
'PhabricatorProjectInterface',
+ 'PhabricatorSearchSnippetInterface',
),
'DifferentialRevisionAffectedFilesHeraldField' => 'DifferentialRevisionHeraldField',
'DifferentialRevisionAuthorHeraldField' => 'DifferentialRevisionHeraldField',
@@ -5025,6 +5027,7 @@
'PhabricatorApplicationTransactionInterface',
'PhabricatorProjectInterface',
'PhabricatorSpacesInterface',
+ 'PhabricatorSearchSnippetInterface',
),
'ManiphestTaskAssignHeraldAction' => 'HeraldAction',
'ManiphestTaskAssignOtherHeraldAction' => 'ManiphestTaskAssignHeraldAction',
@@ -7623,6 +7626,7 @@
'PhabricatorTokenReceiverInterface',
'PhabricatorDestructibleInterface',
'PhabricatorApplicationTransactionInterface',
+ 'PhabricatorSearchSnippetInterface',
),
'PhrictionDocumentAuthorHeraldField' => 'PhrictionDocumentHeraldField',
'PhrictionDocumentContentHeraldField' => 'PhrictionDocumentHeraldField',
diff --git a/src/applications/differential/storage/DifferentialRevision.php b/src/applications/differential/storage/DifferentialRevision.php
--- a/src/applications/differential/storage/DifferentialRevision.php
+++ b/src/applications/differential/storage/DifferentialRevision.php
@@ -13,7 +13,8 @@
PhabricatorApplicationTransactionInterface,
PhabricatorMentionableInterface,
PhabricatorDestructibleInterface,
- PhabricatorProjectInterface {
+ PhabricatorProjectInterface,
+ PhabricatorSearchSnippetInterface {
protected $title = '';
protected $originalTitle;
@@ -629,4 +630,18 @@
$this->saveTransaction();
}
+
+/* -( PhabricatorSearchSnippetInterface )---------------------------------- */
+
+
+ public function renderSearchResultSnippet(PhabricatorUser $viewer) {
+ $content = $this->getSummary();
+ $content = PhabricatorMarkupEngine::summarize($content);
+ $content = PhabricatorMarkupEngine::renderOneObject(
+ id(new PhabricatorMarkupOneOff())->setContent($content),
+ 'default',
+ $viewer);
+ return $content;
+ }
+
}
diff --git a/src/applications/maniphest/storage/ManiphestTask.php b/src/applications/maniphest/storage/ManiphestTask.php
--- a/src/applications/maniphest/storage/ManiphestTask.php
+++ b/src/applications/maniphest/storage/ManiphestTask.php
@@ -13,7 +13,8 @@
PhabricatorDestructibleInterface,
PhabricatorApplicationTransactionInterface,
PhabricatorProjectInterface,
- PhabricatorSpacesInterface {
+ PhabricatorSpacesInterface,
+ PhabricatorSearchSnippetInterface {
const MARKUP_FIELD_DESCRIPTION = 'markup:desc';
@@ -390,4 +391,18 @@
return $this->spacePHID;
}
+
+/* -( PhabricatorSearchSnippetInterface )---------------------------------- */
+
+
+ public function renderSearchResultSnippet(PhabricatorUser $viewer) {
+ $content = $this->getDescription();
+ $content = PhabricatorMarkupEngine::summarize($content);
+ $content = PhabricatorMarkupEngine::renderOneObject(
+ id(new PhabricatorMarkupOneOff())->setContent($content),
+ 'default',
+ $viewer);
+ return $content;
+ }
+
}
diff --git a/src/applications/phriction/storage/PhrictionDocument.php b/src/applications/phriction/storage/PhrictionDocument.php
--- a/src/applications/phriction/storage/PhrictionDocument.php
+++ b/src/applications/phriction/storage/PhrictionDocument.php
@@ -7,7 +7,8 @@
PhabricatorFlaggableInterface,
PhabricatorTokenReceiverInterface,
PhabricatorDestructibleInterface,
- PhabricatorApplicationTransactionInterface {
+ PhabricatorApplicationTransactionInterface,
+ PhabricatorSearchSnippetInterface {
protected $slug;
protected $depth;
@@ -252,4 +253,19 @@
$this->saveTransaction();
}
+
+/* -( PhabricatorSearchSnippetInterface )---------------------------------- */
+
+
+ public function renderSearchResultSnippet(PhabricatorUser $viewer) {
+ $content = $this->getContent()->getContent();
+ $content = PhabricatorMarkupEngine::summarize($content);
+ $content = PhabricatorMarkupEngine::renderOneObject(
+ id(new PhabricatorMarkupOneOff())->setContent($content),
+ 'default',
+ $viewer);
+ return $content;
+ }
+
+
}
diff --git a/src/applications/search/interface/PhabricatorSearchSnippetInterface.php b/src/applications/search/interface/PhabricatorSearchSnippetInterface.php
new file mode 100644
--- /dev/null
+++ b/src/applications/search/interface/PhabricatorSearchSnippetInterface.php
@@ -0,0 +1,11 @@
+<?php
+
+/**
+ * Objects can implement this interface to provide text snippets in search
+ * result views.
+ */
+interface PhabricatorSearchSnippetInterface {
+
+ public function renderSearchResultSnippet(PhabricatorUser $viewer);
+
+}
diff --git a/src/applications/search/query/PhabricatorSearchApplicationSearchEngine.php b/src/applications/search/query/PhabricatorSearchApplicationSearchEngine.php
--- a/src/applications/search/query/PhabricatorSearchApplicationSearchEngine.php
+++ b/src/applications/search/query/PhabricatorSearchApplicationSearchEngine.php
@@ -251,6 +251,7 @@
foreach ($results as $phid => $handle) {
$view = id(new PhabricatorSearchResultView())
+ ->setUser($viewer)
->setHandle($handle)
->setQuery($query)
->setObject(idx($objects, $phid))
diff --git a/src/applications/search/view/PhabricatorSearchResultView.php b/src/applications/search/view/PhabricatorSearchResultView.php
--- a/src/applications/search/view/PhabricatorSearchResultView.php
+++ b/src/applications/search/view/PhabricatorSearchResultView.php
@@ -21,7 +21,13 @@
return $this;
}
+ public function getObject() {
+ return $this->object;
+ }
+
public function render() {
+ $viewer = $this->getUser();
+
$handle = $this->handle;
if (!$handle->isComplete()) {
return;
@@ -46,6 +52,18 @@
$item->addAttribute(pht('Closed'));
}
+ $object = $this->getObject();
+ if ($object instanceof PhabricatorSearchSnippetInterface) {
+ $snippet = $object->renderSearchResultSnippet($viewer);
+ $snippet = phutil_tag(
+ 'div',
+ array(
+ 'class' => 'phui-search-snippet',
+ ),
+ $snippet);
+ $item->appendChild($snippet);
+ }
+
return $item;
}
diff --git a/webroot/rsrc/css/application/search/search-results.css b/webroot/rsrc/css/application/search/search-results.css
--- a/webroot/rsrc/css/application/search/search-results.css
+++ b/webroot/rsrc/css/application/search/search-results.css
@@ -16,3 +16,8 @@
font-weight: normal;
color: #000;
}
+
+.phui-search-snippet {
+ margin: 0 8px;
+ color: {$greytext};
+}

File Metadata

Mime Type
text/plain
Expires
Sun, Jul 27, 7:16 AM (1 w, 1 d ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
8331252
Default Alt Text
D14095.id34070.diff (12 KB)

Event Timeline