mirror of
https://github.com/penpot/penpot.git
synced 2025-03-12 07:41:43 -05:00
🐛 Fix media deletion on first profile photo change.
This commit is contained in:
parent
1ed1c95e4d
commit
8d6d839878
2 changed files with 6 additions and 4 deletions
|
@ -10,7 +10,7 @@
|
|||
(ns uxbox.services.mutations.profile
|
||||
(:require
|
||||
[clojure.spec.alpha :as s]
|
||||
[clojure.string :as str]
|
||||
[cuerdas.core :as str]
|
||||
[datoteka.core :as fs]
|
||||
[promesa.core :as p]
|
||||
[promesa.exec :as px]
|
||||
|
@ -174,8 +174,10 @@
|
|||
photo (upload-photo conn params)]
|
||||
|
||||
;; Schedule deletion of old photo
|
||||
(when (and (string? (:photo profile))
|
||||
(not (str/blank? (:photo profile))))
|
||||
(tasks/schedule! conn {:name "remove-media"
|
||||
:props {:path (:photo profile)}})
|
||||
:props {:path (:photo profile)}}))
|
||||
;; Save new photo
|
||||
(update-profile-photo conn profile-id photo))))
|
||||
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
[uxbox.util.storage :as ust]
|
||||
[vertx.util :as vu]))
|
||||
|
||||
(s/def ::path ::us/string)
|
||||
(s/def ::path ::us/not-empty-string)
|
||||
(s/def ::props
|
||||
(s/keys :req-un [::path]))
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue