From 787a84969fa04c519a9291eaac3f7ebbbb3585fa Mon Sep 17 00:00:00 2001 From: Valerio Bozzolan Date: Wed, 5 Apr 2023 15:39:25 +0200 Subject: [PATCH] Phriction: clarify its search results as "Wiki page" MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- .../typeahead/PhrictionDocumentDatasource.php | 21 +++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/src/applications/phriction/typeahead/PhrictionDocumentDatasource.php b/src/applications/phriction/typeahead/PhrictionDocumentDatasource.php index 09056fe761..8e16051840 100644 --- a/src/applications/phriction/typeahead/PhrictionDocumentDatasource.php +++ b/src/applications/phriction/typeahead/PhrictionDocumentDatasource.php @@ -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)