|
|
@@ -340,11 +340,8 @@
|
|
|
page-ids (->> (map :block/page blocks)
|
|
|
(remove nil?)
|
|
|
(set))
|
|
|
- tx (->> (map (fn [{:block/keys [uuid title content properties] :as block}]
|
|
|
- (let [title (let [title' (walk-replace-old-page! title old-original-name new-name)]
|
|
|
- (when-not (= title' title)
|
|
|
- title'))
|
|
|
- content (let [content' (replace-old-page! content old-original-name new-name)]
|
|
|
+ tx (->> (map (fn [{:block/keys [uuid title content properties format pre-block?] :as block}]
|
|
|
+ (let [content (let [content' (replace-old-page! content old-original-name new-name)]
|
|
|
(when-not (= content' content)
|
|
|
content'))
|
|
|
properties (let [properties' (walk-replace-old-page! properties old-original-name new-name)]
|
|
|
@@ -352,12 +349,13 @@
|
|
|
properties'))]
|
|
|
(when (or title content properties)
|
|
|
(util/remove-nils-non-nested
|
|
|
- {:block/uuid uuid
|
|
|
- :block/title title
|
|
|
- :block/content content
|
|
|
- :block/properties properties
|
|
|
- :block/refs (rename-update-block-refs! (:block/refs block) (:db/id page) (:db/id to-page))
|
|
|
- :block/path-refs (rename-update-block-refs! (:block/path-refs block) (:db/id page) (:db/id to-page))})))) blocks)
|
|
|
+ (merge
|
|
|
+ {:block/uuid uuid
|
|
|
+ :block/content content
|
|
|
+ :block/properties properties
|
|
|
+ :block/refs (rename-update-block-refs! (:block/refs block) (:db/id page) (:db/id to-page))
|
|
|
+ :block/path-refs (rename-update-block-refs! (:block/path-refs block) (:db/id page) (:db/id to-page))}
|
|
|
+ (block/parse-title-and-body format pre-block? content)))))) blocks)
|
|
|
(remove nil?))]
|
|
|
(db/transact! repo tx)
|
|
|
(doseq [page-id page-ids]
|