mirror of
https://github.com/penpot/penpot.git
synced 2025-06-07 14:11:46 +02:00
commit
7a0702650a
5 changed files with 20 additions and 18 deletions
|
@ -226,8 +226,8 @@
|
||||||
[:priority {:optional true} [:enum :high :low]]
|
[:priority {:optional true} [:enum :high :low]]
|
||||||
[:extra-data {:optional true} ::sm/text]])
|
[:extra-data {:optional true} ::sm/text]])
|
||||||
|
|
||||||
(def ^:private valid-context?
|
(def ^:private check-context
|
||||||
(sm/validator schema:context))
|
(sm/check-fn schema:context))
|
||||||
|
|
||||||
(defn template-factory
|
(defn template-factory
|
||||||
[& {:keys [id schema]}]
|
[& {:keys [id schema]}]
|
||||||
|
@ -236,10 +236,8 @@
|
||||||
(sm/check-fn schema)
|
(sm/check-fn schema)
|
||||||
(constantly nil))]
|
(constantly nil))]
|
||||||
(fn [context]
|
(fn [context]
|
||||||
(assert (valid-context? context) "expected a valid context")
|
(let [context (-> context check-context check-fn)
|
||||||
(check-fn context)
|
email (build-email-template id context)]
|
||||||
|
|
||||||
(let [email (build-email-template id context)]
|
|
||||||
(when-not email
|
(when-not email
|
||||||
(ex/raise :type :internal
|
(ex/raise :type :internal
|
||||||
:code :email-template-does-not-exists
|
:code :email-template-does-not-exists
|
||||||
|
@ -271,7 +269,7 @@
|
||||||
"Schedule an already defined email to be sent using asynchronously
|
"Schedule an already defined email to be sent using asynchronously
|
||||||
using worker task."
|
using worker task."
|
||||||
[{:keys [::conn ::factory] :as context}]
|
[{:keys [::conn ::factory] :as context}]
|
||||||
(assert (db/connection? conn) "expected a valid database connection")
|
(assert (db/connectable? conn) "expected a valid database connection or pool")
|
||||||
|
|
||||||
(let [email (if factory
|
(let [email (if factory
|
||||||
(factory context)
|
(factory context)
|
||||||
|
@ -348,7 +346,7 @@
|
||||||
[:subject ::sm/text]
|
[:subject ::sm/text]
|
||||||
[:content ::sm/text]])
|
[:content ::sm/text]])
|
||||||
|
|
||||||
(def feedback
|
(def user-feedback
|
||||||
"A profile feedback email."
|
"A profile feedback email."
|
||||||
(template-factory
|
(template-factory
|
||||||
:id ::feedback
|
:id ::feedback
|
||||||
|
|
|
@ -17,7 +17,7 @@
|
||||||
[app.rpc.doc :as-alias doc]
|
[app.rpc.doc :as-alias doc]
|
||||||
[app.util.services :as sv]))
|
[app.util.services :as sv]))
|
||||||
|
|
||||||
(declare ^:private send-feedback!)
|
(declare ^:private send-user-feedback!)
|
||||||
|
|
||||||
(def ^:private schema:send-user-feedback
|
(def ^:private schema:send-user-feedback
|
||||||
[:map {:title "send-user-feedback"}
|
[:map {:title "send-user-feedback"}
|
||||||
|
@ -34,14 +34,16 @@
|
||||||
:hint "feedback not enabled"))
|
:hint "feedback not enabled"))
|
||||||
|
|
||||||
(let [profile (profile/get-profile pool profile-id)]
|
(let [profile (profile/get-profile pool profile-id)]
|
||||||
(send-feedback! pool profile params)
|
(send-user-feedback! pool profile params)
|
||||||
nil))
|
nil))
|
||||||
|
|
||||||
(defn- send-feedback!
|
(defn- send-user-feedback!
|
||||||
[pool profile params]
|
[pool profile params]
|
||||||
(let [dest (cf/get :feedback-destination)]
|
(let [dest (or (cf/get :user-feedback-destination)
|
||||||
|
;; LEGACY
|
||||||
|
(cf/get :feedback-destination))]
|
||||||
(eml/send! {::eml/conn pool
|
(eml/send! {::eml/conn pool
|
||||||
::eml/factory eml/feedback
|
::eml/factory eml/user-feedback
|
||||||
:from dest
|
:from dest
|
||||||
:to dest
|
:to dest
|
||||||
:profile profile
|
:profile profile
|
||||||
|
|
|
@ -450,7 +450,9 @@
|
||||||
(ptk/reify ::update-team
|
(ptk/reify ::update-team
|
||||||
ptk/UpdateEvent
|
ptk/UpdateEvent
|
||||||
(update [_ state]
|
(update [_ state]
|
||||||
(assoc-in state [:teams id :name] name))
|
(-> state
|
||||||
|
(assoc-in [:teams id :name] name)
|
||||||
|
(assoc-in [:team :name] name)))
|
||||||
|
|
||||||
ptk/WatchEvent
|
ptk/WatchEvent
|
||||||
(watch [_ _ _]
|
(watch [_ _ _]
|
||||||
|
|
|
@ -73,7 +73,9 @@
|
||||||
{::mf/register modal/components
|
{::mf/register modal/components
|
||||||
::mf/register-as :team-form}
|
::mf/register-as :team-form}
|
||||||
[{:keys [team] :as props}]
|
[{:keys [team] :as props}]
|
||||||
(let [initial (mf/use-memo (fn [] (or team {})))
|
(let [initial (mf/use-memo (fn []
|
||||||
|
(or (some-> team (select-keys [:name :id]))
|
||||||
|
{})))
|
||||||
form (fm/use-form :schema schema:team-form
|
form (fm/use-form :schema schema:team-form
|
||||||
:initial initial)
|
:initial initial)
|
||||||
handle-keydown
|
handle-keydown
|
||||||
|
|
|
@ -148,9 +148,7 @@
|
||||||
(mf/set-ref-val! internal-state initial))
|
(mf/set-ref-val! internal-state initial))
|
||||||
|
|
||||||
(mf/with-effect [initial]
|
(mf/with-effect [initial]
|
||||||
(if (fn? initial)
|
(swap! form-mutator d/deep-merge initial))
|
||||||
(swap! form-mutator update :data merge (initial))
|
|
||||||
(swap! form-mutator update :data merge initial)))
|
|
||||||
|
|
||||||
form-mutator))
|
form-mutator))
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue