1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-25 16:22:43 +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:
Valerio Bozzolan 2023-04-05 15:39:25 +02:00
parent 306ce1c0b7
commit 787a84969f

View file

@ -18,6 +18,9 @@ final class PhrictionDocumentDatasource
public function loadResults() {
$viewer = $this->getViewer();
$app_type = pht('Wiki Document');
$mid_dot = "\xC2\xB7";
$query = id(new PhrictionDocumentQuery())
->setViewer($viewer)
->needContent(true);
@ -34,15 +37,25 @@ final class PhrictionDocumentDatasource
foreach ($documents as $document) {
$content = $document->getContent();
if (!$document->isActive()) {
$closed = $document->getStatusDisplayName();
} else {
if ($document->isActive()) {
$closed = null;
} else {
$closed = $document->getStatusDisplayName();
}
$slug = $document->getSlug();
$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';
$autocomplete = '[[ '.$slug.' ]]';
@ -51,7 +64,7 @@ final class PhrictionDocumentDatasource
->setDisplayName($title)
->setURI($document->getURI())
->setPHID($document->getPHID())
->setDisplayType($slug)
->setDisplayType($display_type)
->setPriorityType('wiki')
->setImageSprite($sprite)
->setAutocomplete($autocomplete)