mirror of
https://github.com/penpot/penpot.git
synced 2025-04-06 20:11:29 -05:00
Merge remote-tracking branch 'origin/staging' into develop
This commit is contained in:
commit
cd87cbe44e
8 changed files with 25 additions and 20 deletions
|
@ -409,8 +409,9 @@
|
|||
[cfg data file-id]
|
||||
(let [library-ids (get-libraries cfg [file-id])]
|
||||
(reduce (fn [data library-id]
|
||||
(let [library (get-file cfg library-id)]
|
||||
(ctf/absorb-assets data (:data library))))
|
||||
(if-let [library (get-file cfg library-id)]
|
||||
(ctf/absorb-assets data (:data library))
|
||||
data))
|
||||
data
|
||||
library-ids)))
|
||||
|
||||
|
|
|
@ -530,7 +530,7 @@
|
|||
|
||||
(defn- match-storage-entry-fn
|
||||
[]
|
||||
(let [pattern (str "^objects/([^/]+).json$")
|
||||
(let [pattern "^objects/([^/]+).json$"
|
||||
pattern (re-pattern pattern)]
|
||||
(fn [entry]
|
||||
(when-let [[_ id] (re-matches pattern (zip-entry-name entry))]
|
||||
|
|
|
@ -55,13 +55,16 @@
|
|||
::yres/body (ex-data err)})
|
||||
|
||||
(defmethod handle-error :restriction
|
||||
[err _ _]
|
||||
[err request _]
|
||||
(let [{:keys [code] :as data} (ex-data err)]
|
||||
(if (= code :method-not-allowed)
|
||||
{::yres/status 405
|
||||
::yres/body data}
|
||||
{::yres/status 400
|
||||
::yres/body data})))
|
||||
|
||||
(binding [l/*context* (request->context request)]
|
||||
(l/err :hint "restriction error" :data data)
|
||||
{::yres/status 400
|
||||
::yres/body data}))))
|
||||
|
||||
(defmethod handle-error :rate-limit
|
||||
[err _ _]
|
||||
|
|
|
@ -59,7 +59,7 @@
|
|||
:props (pp/pprint-str props :length 50)
|
||||
:hint (or (ex-message cause) @message)
|
||||
:trace (or (::trace record)
|
||||
(ex/format-throwable cause :data? false :explain? false :header? false :summary? false))}
|
||||
(some-> cause (ex/format-throwable :data? false :explain? false :header? false :summary? false)))}
|
||||
|
||||
(when-let [params (or (:request/params context) (:params context))]
|
||||
{:params (pp/pprint-str params :length 30 :level 13)})
|
||||
|
@ -74,9 +74,8 @@
|
|||
{:explain explain})))))
|
||||
|
||||
(defn error-record?
|
||||
[{:keys [::l/level ::l/cause]}]
|
||||
(and (= :error level)
|
||||
(ex/exception? cause)))
|
||||
[{:keys [::l/level]}]
|
||||
(= :error level))
|
||||
|
||||
(defn- handle-event
|
||||
[{:keys [::db/pool]} {:keys [::l/id] :as record}]
|
||||
|
|
|
@ -55,7 +55,7 @@
|
|||
(let [conn (db/get-connection h/*system*)
|
||||
used (cfh/collect-used-media data)
|
||||
ids (db/create-array conn "uuid" used)
|
||||
sql (str "SELECT * FROM file_media_object WHERE id = ANY(?)")
|
||||
sql "SELECT * FROM file_media_object WHERE id = ANY(?)"
|
||||
rows (db/exec! conn [sql ids])
|
||||
index (reduce (fn [index media]
|
||||
(if (not= (:file-id media) id)
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
(mapcat (fn [object]
|
||||
(->> (cfh/collect-shape-media-refs object)
|
||||
(map (fn [id]
|
||||
{:object-id (:id object)
|
||||
{:shape-id (:id object)
|
||||
:id id}))))))
|
||||
process-page
|
||||
(fn [result page-id container]
|
||||
|
|
|
@ -39,10 +39,7 @@
|
|||
([id]
|
||||
(get-file (or *system* main/system) id))
|
||||
([system id]
|
||||
(db/run! system
|
||||
(fn [system]
|
||||
(->> (bfc/get-file system id ::db/for-update true)
|
||||
(bfc/decode-file system))))))
|
||||
(db/run! system bfc/get-file id)))
|
||||
|
||||
(defn get-raw-file
|
||||
"Get the migrated data of one file."
|
||||
|
@ -135,9 +132,10 @@
|
|||
(bfc/get-file system id))))
|
||||
(d/index-by :id)))
|
||||
|
||||
file' (if with-libraries?
|
||||
(update-fn file libs opts)
|
||||
(update-fn file opts))]
|
||||
file' (when file
|
||||
(if with-libraries?
|
||||
(update-fn file libs opts)
|
||||
(update-fn file opts)))]
|
||||
|
||||
(when (and (some? file')
|
||||
(not (identical? file file')))
|
||||
|
|
|
@ -673,7 +673,7 @@
|
|||
(d/update-in-when data [:components component-id] update-container))))
|
||||
|
||||
(defn- process-operations
|
||||
[objects {:keys [id operations] :as change}]
|
||||
[objects {:keys [page-id id operations] :as change}]
|
||||
(if-let [shape (get objects id)]
|
||||
(let [shape (reduce process-operation shape operations)
|
||||
touched? (-> shape meta ::ctn/touched)]
|
||||
|
@ -682,6 +682,10 @@
|
|||
;; need to report them for to be used in the second
|
||||
;; phase of changes procesing
|
||||
(when touched? (some-> *touched-changes* (vswap! conj change)))
|
||||
|
||||
(when (and *state* page-id)
|
||||
(swap! *state* collect-shape-media-refs shape page-id))
|
||||
|
||||
(assoc objects id shape))
|
||||
|
||||
objects))
|
||||
|
|
Loading…
Add table
Reference in a new issue