Make hubspot contact creation configurable
This commit is contained in:
parent
c81ec65bc6
commit
69f2a7380c
|
@ -12,6 +12,8 @@
|
||||||
[clojure.string :as str]))
|
[clojure.string :as str]))
|
||||||
|
|
||||||
|
|
||||||
|
(defn hubspot-contact-create-enabled []
|
||||||
|
(env :hubspot-contact-create-enabled false))
|
||||||
|
|
||||||
(defn- create-user [token user]
|
(defn- create-user [token user]
|
||||||
(let [{name :name
|
(let [{name :name
|
||||||
|
@ -47,7 +49,8 @@
|
||||||
new-user? (nil? (users/get-user (:id gh-user 0)))
|
new-user? (nil? (users/get-user (:id gh-user 0)))
|
||||||
user (assoc (get-or-create-user access-token)
|
user (assoc (get-or-create-user access-token)
|
||||||
token-key access-token)]
|
token-key access-token)]
|
||||||
(when new-user?
|
(when (and (hubspot-contact-create-enabled)
|
||||||
|
new-user?)
|
||||||
(try
|
(try
|
||||||
(hubspot/create-hubspot-contact (:email user)
|
(hubspot/create-hubspot-contact (:email user)
|
||||||
(:name user "")
|
(:name user "")
|
||||||
|
|
Loading…
Reference in New Issue