diff --git a/deps/graph-parser/src/logseq/graph_parser/exporter.cljs b/deps/graph-parser/src/logseq/graph_parser/exporter.cljs index e40302d185..9138576a84 100644 --- a/deps/graph-parser/src/logseq/graph_parser/exporter.cljs +++ b/deps/graph-parser/src/logseq/graph_parser/exporter.cljs @@ -76,8 +76,8 @@ (let [m (if (:block/namespace class-block) ;; Give namespaced tags a unique ident so they don't conflict with other tags - (-> (db-class/build-new-class db {:block/title (build-class-ident-name class-name) - :block/tags (:block/tags class-block)}) + (-> (db-class/build-new-class db (merge {:block/title (build-class-ident-name class-name)} + (select-keys class-block [:block/tags]))) (merge {:block/title class-name :block/name (common-util/page-name-sanity-lc class-name)}) (build-new-namespace-page)) @@ -1250,25 +1250,6 @@ [(:block/name %) (date-time-util/journal-day->ms journal-day)])) (into {}))) -(defn- remove-alias-if-equals-to-page-name - [pages] - (let [[page alias] (some (fn [page] (when (and (:block/namespace page) (:block/alias page)) - [page (:block/alias page)])) pages) - page-last-part (when page (common-util/page-name-sanity-lc (ns-util/get-last-part (:block/name page)))) - self-alias? (and (seq alias) (some #(= page-last-part (:block/name %)) alias))] - (if self-alias? - (->> pages - (remove (fn [p] - (= (:block/name p) page-last-part))) - (map (fn [p] - (if (= (:block/uuid p) (:block/uuid page)) - (-> page - (dissoc :block/alias) - (update :block/properties dissoc :alias) - (update :block/properties-text-values dissoc :alias)) - p)))) - pages))) - (defn- clean-extra-invalid-tags "If a page/class tx is an existing property or a new or existing class, ensure that it only has one tag by removing :logseq.class/Page from its tx" @@ -1312,12 +1293,11 @@ :as *options}] (let [options (assoc *options :notify-user notify-user :log-fn log-fn) {:keys [pages blocks]} (extract-pages-and-blocks @conn file content options) - pages' (remove-alias-if-equals-to-page-name pages) tx-options (merge (build-tx-options options) - {:journal-created-ats (build-journal-created-ats pages')}) + {:journal-created-ats (build-journal-created-ats pages)}) old-properties (keys @(get-in options [:import-state :property-schemas])) ;; Build page and block txs - {:keys [pages-tx page-properties-tx per-file-state existing-pages]} (build-pages-tx conn pages' blocks tx-options) + {:keys [pages-tx page-properties-tx per-file-state existing-pages]} (build-pages-tx conn pages blocks tx-options) whiteboard-pages (->> pages-tx ;; support old and new whiteboards (filter ldb/whiteboard?) diff --git a/deps/graph-parser/test/logseq/graph_parser/exporter_test.cljs b/deps/graph-parser/test/logseq/graph_parser/exporter_test.cljs index a578d08a46..01e99f6829 100644 --- a/deps/graph-parser/test/logseq/graph_parser/exporter_test.cljs +++ b/deps/graph-parser/test/logseq/graph_parser/exporter_test.cljs @@ -320,6 +320,14 @@ (is (= #{"gpt"} (:block/alias (readable-properties @conn (db-test/find-page-by-title @conn "chat-gpt")))) "alias set correctly") + (is (= ["y"] + (->> (d/q '[:find [?b ...] :where [?b :block/title "y"] [?b :logseq.property/parent]] + @conn) + first + (d/entity @conn) + :block/alias + (map :block/title))) + "alias set correctly on namespaced page") (is (= {:logseq.property.linked-references/includes #{"Oct 9th, 2024"} :logseq.property.linked-references/excludes #{"ref2"}}