mirror of
https://github.com/penpot/penpot.git
synced 2025-03-13 00:01:51 -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
|
(ns uxbox.services.mutations.profile
|
||||||
(:require
|
(:require
|
||||||
[clojure.spec.alpha :as s]
|
[clojure.spec.alpha :as s]
|
||||||
[clojure.string :as str]
|
[cuerdas.core :as str]
|
||||||
[datoteka.core :as fs]
|
[datoteka.core :as fs]
|
||||||
[promesa.core :as p]
|
[promesa.core :as p]
|
||||||
[promesa.exec :as px]
|
[promesa.exec :as px]
|
||||||
|
@ -174,8 +174,10 @@
|
||||||
photo (upload-photo conn params)]
|
photo (upload-photo conn params)]
|
||||||
|
|
||||||
;; Schedule deletion of old photo
|
;; Schedule deletion of old photo
|
||||||
|
(when (and (string? (:photo profile))
|
||||||
|
(not (str/blank? (:photo profile))))
|
||||||
(tasks/schedule! conn {:name "remove-media"
|
(tasks/schedule! conn {:name "remove-media"
|
||||||
:props {:path (:photo profile)}})
|
:props {:path (:photo profile)}}))
|
||||||
;; Save new photo
|
;; Save new photo
|
||||||
(update-profile-photo conn profile-id photo))))
|
(update-profile-photo conn profile-id photo))))
|
||||||
|
|
||||||
|
|
|
@ -18,7 +18,7 @@
|
||||||
[uxbox.util.storage :as ust]
|
[uxbox.util.storage :as ust]
|
||||||
[vertx.util :as vu]))
|
[vertx.util :as vu]))
|
||||||
|
|
||||||
(s/def ::path ::us/string)
|
(s/def ::path ::us/not-empty-string)
|
||||||
(s/def ::props
|
(s/def ::props
|
||||||
(s/keys :req-un [::path]))
|
(s/keys :req-un [::path]))
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue