diff --git a/backend/src/app/loggers/mattermost.clj b/backend/src/app/loggers/mattermost.clj index 34120a3604..fc0109bdda 100644 --- a/backend/src/app/loggers/mattermost.clj +++ b/backend/src/app/loggers/mattermost.clj @@ -63,15 +63,12 @@ [cfg {:keys [host version id] :as cdata}] (try (let [uri (:uri cfg) - text (str "Unhandled exception:\n" - "- detail: " (cfg/get :public-uri) "/dbg/error-by-id/" id "\n" - "- profile-id: `" (:profile-id cdata) "`\n" - "- host: `" host "`\n" - "- version: `" version "`\n") - rsp (http/send! {:uri uri - :method :post - :headers {"content-type" "application/json"} - :body (json/encode-str {:text text})})] + text (str "Unhandled exception (host: " host ", url: " (cfg/get :public-uri) "/dbg/error-by-id/" id "\n" + "- profile-id: #" (:profile-id cdata) "\n") + rsp (http/send! {:uri uri + :method :post + :headers {"content-type" "application/json"} + :body (json/encode-str {:text text})})] (when (not= (:status rsp) 200) (l/error :hint "error on sending data to mattermost" :response (pr-str rsp)))) diff --git a/common/src/app/common/pages/common.cljc b/common/src/app/common/pages/common.cljc index 29319abef4..8a99ac3f3c 100644 --- a/common/src/app/common/pages/common.cljc +++ b/common/src/app/common/pages/common.cljc @@ -8,7 +8,7 @@ (:require [app.common.uuid :as uuid])) -(def file-version 8) +(def file-version 11) (def default-color "#b1b2b5") ;; $color-gray-20 (def root uuid/zero) diff --git a/common/src/app/common/pages/migrations.cljc b/common/src/app/common/pages/migrations.cljc index 7a12167807..f06c79563f 100644 --- a/common/src/app/common/pages/migrations.cljc +++ b/common/src/app/common/pages/migrations.cljc @@ -222,3 +222,49 @@ (update :pages-index #(d/mapm clean-container %)) (d/update-when :components #(d/mapm clean-container %))))) +(defmethod migrate 9 + [data] + (letfn [(find-empty-groups [objects] + (->> (vals objects) + (filter (fn [shape] + (and (= :group (:type shape)) + (or (empty? (:shapes shape)) + (every? (fn [child-id] + (not (contains? objects child-id))) + (:shapes shape)))))) + (map :id))) + + (calculate-changes [[page-id page]] + (let [objects (:objects page) + eids (find-empty-groups objects)] + + (map (fn [id] + {:type :del-obj + :page-id page-id + :id id}) + eids)))] + + (loop [data data] + (let [changes (mapcat calculate-changes (:pages-index data))] + (if (seq changes) + (recur (cp/process-changes data changes)) + data))))) + +(defmethod migrate 10 + [data] + (letfn [(update-page [_ page] + (d/update-in-when page [:objects uuid/zero] dissoc :points :selrect))] + (update data :pages-index #(d/mapm update-page %)))) + +(defmethod migrate 11 + [data] + (letfn [(update-object [objects id shape] + (if (= :frame (:type shape)) + (d/update-when shape :shapes (fn [shapes] + (filterv (fn [id] (contains? objects id)) shapes))) + shape)) + + (update-page [_ page] + (update page :objects #(d/mapm (partial update-object %) %)))] + + (update data :pages-index #(d/mapm update-page %))))