mirror of
https://github.com/logseq/logseq.git
synced 2026-02-01 22:47:36 +00:00
fix: tag completion showing 2 entries for an existing tag
including 'New tag'. Regression from e92ea7a771
This commit is contained in:
@@ -136,18 +136,20 @@
|
||||
|
||||
(defn- matched-pages-with-new-page [partial-matched-pages db-tag? q]
|
||||
(if (or
|
||||
(if db-tag?
|
||||
(let [entity (db/get-page q)]
|
||||
(and (ldb/internal-page? entity) (= (:block/title entity) q)))
|
||||
;; Page existence here should be the same as entity-util/page?.
|
||||
;; Don't show 'New page' if a page has any of these tags
|
||||
(db/page-exists? q db-class/page-classes))
|
||||
|
||||
(db/page-exists? q (if db-tag?
|
||||
#{:logseq.class/Tag}
|
||||
;; Page existence here should be the same as entity-util/page?.
|
||||
;; Don't show 'New page' if a page has any of these tags
|
||||
db-class/page-classes))
|
||||
(and db-tag? (some ldb/class? (:block/_alias (db/get-page q)))))
|
||||
partial-matched-pages
|
||||
(if db-tag?
|
||||
(concat [{:block/title (str (t :new-tag) " " q)}]
|
||||
partial-matched-pages)
|
||||
(concat
|
||||
;; Don't show 'New tag' for an internal page because it already shows 'Convert ...'
|
||||
(when-not (let [entity (db/get-page q)]
|
||||
(and (ldb/internal-page? entity) (= (:block/title entity) q)))
|
||||
[{:block/title (str (t :new-tag) " " q)}])
|
||||
partial-matched-pages)
|
||||
(cons {:block/title (str (t :new-page) " " q)}
|
||||
partial-matched-pages))))
|
||||
|
||||
|
||||
Reference in New Issue
Block a user