Skip to content

Commit

Permalink
fix: search modal shows alias' source page names instead of source or…
Browse files Browse the repository at this point in the history
…iginal names
  • Loading branch information
cnrpman authored and tiensonqin committed Jan 10, 2022
1 parent c2daea7 commit bc32e8f
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions src/main/frontend/components/search.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -96,17 +96,17 @@
{:type :page
:data page}
(and alias
(not= (string/lower-case page)
(string/lower-case alias)))
(not= (util/page-name-sanity-lc page)
(util/page-name-sanity-lc alias)))
(assoc :alias alias))))
(remove nil? pages)))
files (when-not all? (map (fn [file] {:type :file :data file}) files))
blocks (map (fn [block] {:type :block :data block}) blocks)
search-mode (state/sub :search/mode)
new-page (if (or
(and (seq pages)
(= (util/safe-lower-case search-q)
(util/safe-lower-case (:data (first pages)))))
(= (util/safe-page-name-sanity-lc search-q)
(util/safe-page-name-sanity-lc (:data (first pages)))))
(nil? result)
all?)
[]
Expand Down Expand Up @@ -199,7 +199,9 @@
:page
[:span {:data-page-ref data}
(when alias
[:span.mr-2.text-sm.font-medium.mb-2 (str "Alias -> " alias)])
(let [target-entity (db/get-page alias)
target-original-name (util/get-page-original-name target-entity)]
[:span.mr-2.text-sm.font-medium.mb-2 (str "Alias -> " target-original-name)]))
(search-result-item "Page" (highlight-exact-query data search-q))]

:file
Expand Down

0 comments on commit bc32e8f

Please sign in to comment.