From 3da0d85d8f135668c9ad6ab46729308fa7b02d5a Mon Sep 17 00:00:00 2001 From: Andrey Antukh Date: Fri, 7 Jul 2023 10:35:06 +0200 Subject: [PATCH] :bug: Set correct project modified-at on moving files between projects Happens when you use drag and drop on dashboard for moving files between projects, but also if you use a context menu actions --- CHANGES.md | 1 + frontend/src/app/main/data/dashboard.cljs | 11 ++++++++--- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/CHANGES.md b/CHANGES.md index af53fe712..0acd520a9 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -53,6 +53,7 @@ - Fix problem with importation process [Taiga #5597](https://tree.taiga.io/project/penpot/issue/5597) - Fix problem with HSV color picker [#3317](https://github.com/penpot/penpot/issues/3317) - Fix problem with slashes in layers names for exporter [#3276](https://github.com/penpot/penpot/issues/3276) +- Fix incorrect modified data on moving files on dashboard [Taiga #5530](https://tree.taiga.io/project/penpot/issue/5530) ### :arrow_up: Deps updates diff --git a/frontend/src/app/main/data/dashboard.cljs b/frontend/src/app/main/data/dashboard.cljs index 4b6134665..0995fefeb 100644 --- a/frontend/src/app/main/data/dashboard.cljs +++ b/frontend/src/app/main/data/dashboard.cljs @@ -10,6 +10,7 @@ [app.common.data.macros :as dm] [app.common.pages :as cp] [app.common.schema :as sm] + [app.common.time :as dt] [app.common.uri :as u] [app.common.uuid :as uuid] [app.config :as cf] @@ -872,10 +873,14 @@ ptk/UpdateEvent (update [_ state] - (let [origin-project (get-in state [:dashboard-files (first ids) :project-id])] + (let [origin-project (get-in state [:dashboard-files (first ids) :project-id]) + update-project (fn [project] + (-> project + (update :count #(+ % (count ids))) + (assoc :modified-at (dt/now))))] (-> state - (d/update-in-when [:dashboard-projects origin-project] update :count #(- % (count ids))) - (d/update-in-when [:dashboard-projects project-id] update :count #(+ % (count ids)))))) + (d/update-in-when [:dashboard-projects origin-project] update-project) + (d/update-in-when [:dashboard-projects project-id] update-project)))) ptk/WatchEvent (watch [_ _ _]