Merge pull request #6876 from penpot/niwinz-develop-minor-changes-logical-deletion

 Change default status filtering for logical deletion
This commit is contained in:
Alejandro Alonso 2025-07-24 10:58:49 +02:00 committed by GitHub
commit f7627e515a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -10,18 +10,19 @@
[app.config :as cf] [app.config :as cf]
[app.util.time :as dt])) [app.util.time :as dt]))
(def ^:private canceled-status
#{"canceled" "unpaid"})
(defn get-deletion-delay (defn get-deletion-delay
"Calculate the next deleted-at for a resource (file, team, etc) in function "Calculate the next deleted-at for a resource (file, team, etc) in function
of team settings" of team settings"
[team] [team]
(if-let [subscription (get team :subscription)] (if-let [{:keys [type status]} (get team :subscription)]
(cond (cond
(and (= (:type subscription) "unlimited") (and (= "unlimited" type) (not (contains? canceled-status status)))
(= (:status subscription) "active"))
(dt/duration {:days 30}) (dt/duration {:days 30})
(and (= (:type subscription) "enterprise") (and (= "enterprise" type) (not (contains? canceled-status status)))
(= (:status subscription) "active"))
(dt/duration {:days 90}) (dt/duration {:days 90})
:else :else