🐛 Set correct modification date on projects on file move operation

This commit is contained in:
Andrey Antukh 2023-07-28 13:18:19 +02:00
parent 21430cbd7d
commit 1f98b168ba
2 changed files with 20 additions and 6 deletions

View file

@ -10,7 +10,6 @@
[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]
@ -23,6 +22,7 @@
[app.util.dom :as dom]
[app.util.i18n :as i18n :refer [tr]]
[app.util.router :as rt]
[app.util.time :as dt]
[app.util.timers :as tm]
[app.util.webapi :as wapi]
[beicon.core :as rx]
@ -863,6 +863,7 @@
[{:keys [ids project-id] :as params}]
(dm/assert! (sm/set-of-uuid? ids))
(dm/assert! (uuid? project-id))
(ptk/reify ::move-files
IDeref
(-deref [_]
@ -872,13 +873,13 @@
ptk/UpdateEvent
(update [_ state]
(let [origin-project (get-in state [:dashboard-files (first ids) :project-id])
update-project (fn [project]
update-project (fn [project delta]
(-> project
(update :count #(+ % (count ids)))
(assoc :modified-at (dt/now))))]
(assoc :modified-at (dt/plus (dt/now) {:milliseconds delta}))))]
(-> state
(d/update-in-when [:dashboard-projects origin-project] update-project)
(d/update-in-when [:dashboard-projects project-id] update-project))))
(d/update-in-when [:dashboard-projects origin-project] update-project 0)
(d/update-in-when [:dashboard-projects project-id] update-project 10))))
ptk/WatchEvent
(watch [_ _ _]