mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-29 10:12:41 +01:00
Phriction: clarify its search results as "Wiki page"
Summary: This patch changes a bit how your search results from Phriction are described in the autocomplete component (the "Typehead"): {F276843} After this change, Phriction search results will also contain the word "Wiki page" so that users can better understand what the result actually is. Just like a Diffusion repository mentions that it's a "Repository", and just like a Project mentions that it's a "Project" and so on. Before this change, the Typehead entries were only mentioning the slug of that wiki page. | Before | After | | {F274820} | {F272278} | It's unclear if the previous behavior was a mistake (since the internal parameter of the Typehead is called "type", and so, it is supposed to mention the application type, not the slug. Anyway, as a compromise, the slug is still mentioned. To be honest this is just an excuse to put the middle dot / aka interpunct character in this project again. Yeah, here the middle point was used as separator. The apparent reason is: because the middle point was already in use elsewhere in Phorge. The real reason is: I'm a lobbyist in a corporation that sells interpuncts worldwide as our core business, and so, I designed thisvil plan to put the following middle point - again - in Phorge (evil laugh). Closes T15213 Test Plan: - Search "Change Log" in the up-right bar (or similar) - You see "Wiki Page · change_log/" (or similar) Reviewers: O1 Blessed Committers, Cigaryno, avivey Reviewed By: O1 Blessed Committers, Cigaryno, avivey Subscribers: avivey, speck, tobiaswiese, Matthew, Cigaryno Tags: #phriction Maniphest Tasks: T15213 Differential Revision: https://we.phorge.it/D25102
This commit is contained in:
parent
306ce1c0b7
commit
787a84969f
1 changed files with 17 additions and 4 deletions
|
@ -18,6 +18,9 @@ final class PhrictionDocumentDatasource
|
||||||
public function loadResults() {
|
public function loadResults() {
|
||||||
$viewer = $this->getViewer();
|
$viewer = $this->getViewer();
|
||||||
|
|
||||||
|
$app_type = pht('Wiki Document');
|
||||||
|
$mid_dot = "\xC2\xB7";
|
||||||
|
|
||||||
$query = id(new PhrictionDocumentQuery())
|
$query = id(new PhrictionDocumentQuery())
|
||||||
->setViewer($viewer)
|
->setViewer($viewer)
|
||||||
->needContent(true);
|
->needContent(true);
|
||||||
|
@ -34,15 +37,25 @@ final class PhrictionDocumentDatasource
|
||||||
foreach ($documents as $document) {
|
foreach ($documents as $document) {
|
||||||
$content = $document->getContent();
|
$content = $document->getContent();
|
||||||
|
|
||||||
if (!$document->isActive()) {
|
if ($document->isActive()) {
|
||||||
$closed = $document->getStatusDisplayName();
|
|
||||||
} else {
|
|
||||||
$closed = null;
|
$closed = null;
|
||||||
|
} else {
|
||||||
|
$closed = $document->getStatusDisplayName();
|
||||||
}
|
}
|
||||||
|
|
||||||
$slug = $document->getSlug();
|
$slug = $document->getSlug();
|
||||||
$title = $content->getTitle();
|
$title = $content->getTitle();
|
||||||
|
|
||||||
|
// For some time the search result was
|
||||||
|
// just mentioning the document slug.
|
||||||
|
// Now, it also mentions the application type.
|
||||||
|
// Example: "Wiki Document - /foo/bar"
|
||||||
|
$display_type = sprintf(
|
||||||
|
'%s %s %s',
|
||||||
|
$app_type,
|
||||||
|
$mid_dot,
|
||||||
|
$slug);
|
||||||
|
|
||||||
$sprite = 'phabricator-search-icon phui-font-fa phui-icon-view fa-book';
|
$sprite = 'phabricator-search-icon phui-font-fa phui-icon-view fa-book';
|
||||||
$autocomplete = '[[ '.$slug.' ]]';
|
$autocomplete = '[[ '.$slug.' ]]';
|
||||||
|
|
||||||
|
@ -51,7 +64,7 @@ final class PhrictionDocumentDatasource
|
||||||
->setDisplayName($title)
|
->setDisplayName($title)
|
||||||
->setURI($document->getURI())
|
->setURI($document->getURI())
|
||||||
->setPHID($document->getPHID())
|
->setPHID($document->getPHID())
|
||||||
->setDisplayType($slug)
|
->setDisplayType($display_type)
|
||||||
->setPriorityType('wiki')
|
->setPriorityType('wiki')
|
||||||
->setImageSprite($sprite)
|
->setImageSprite($sprite)
|
||||||
->setAutocomplete($autocomplete)
|
->setAutocomplete($autocomplete)
|
||||||
|
|
Loading…
Reference in a new issue