From 03040ed40beae974493ae3ddbc31080011d48ef6 Mon Sep 17 00:00:00 2001 From: "alonso.torres" Date: Fri, 6 Sep 2024 11:02:02 +0200 Subject: [PATCH] :bug: Fix problem when dismissing shared library update --- CHANGES.md | 1 + backend/src/app/rpc/commands/files.clj | 2 +- backend/src/app/util/time.clj | 15 ++++++++------- 3 files changed, 10 insertions(+), 8 deletions(-) diff --git a/CHANGES.md b/CHANGES.md index 39f0a47a30..8943da36cc 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -80,6 +80,7 @@ - Fix problem with overlay positions in viewer [Taiga #8464](https://tree.taiga.io/project/penpot/issue/8464) - Fix layer panel overflowing [Taiga #8665](https://tree.taiga.io/project/penpot/issue/8665) - Fix problem when creating a component instance from grid layout [Github #4881](https://github.com/penpot/penpot/issues/4881) +- Fix problem when dismissing shared library update [Taiga #8669](https://tree.taiga.io/project/penpot/issue/8669) ## 2.1.5 diff --git a/backend/src/app/rpc/commands/files.clj b/backend/src/app/rpc/commands/files.clj index d3317ac2b3..79381d34f8 100644 --- a/backend/src/app/rpc/commands/files.clj +++ b/backend/src/app/rpc/commands/files.clj @@ -1058,7 +1058,7 @@ (def ^:private schema:ignore-file-library-sync-status [:map {:title "ignore-file-library-sync-status"} [:file-id ::sm/uuid] - [:date ::dt/duration]]) + [:date ::dt/instant]]) ;; TODO: improve naming (sv/defmethod ::ignore-file-library-sync-status diff --git a/backend/src/app/util/time.clj b/backend/src/app/util/time.clj index 6d40df6aa1..c1526bfb4f 100644 --- a/backend/src/app/util/time.clj +++ b/backend/src/app/util/time.clj @@ -141,21 +141,22 @@ ;; --- INSTANT +(defn instant? + [v] + (instance? Instant v)) + (defn instant ([s] - (if (int? s) - (Instant/ofEpochMilli s) - (Instant/parse s))) + (cond + (instant? s) s + (int? s) (Instant/ofEpochMilli s) + :else (Instant/parse s))) ([s fmt] (case fmt :rfc1123 (Instant/from (.parse DateTimeFormatter/RFC_1123_DATE_TIME ^String s)) :iso (Instant/from (.parse DateTimeFormatter/ISO_INSTANT ^String s)) :iso8601 (Instant/from (.parse DateTimeFormatter/ISO_INSTANT ^String s))))) -(defn instant? - [v] - (instance? Instant v)) - (defn is-after? [da db] (.isAfter ^Instant da ^Instant db))