Fix misc build errors

This commit is contained in:
Oskar Thorén 2017-11-10 16:23:25 +00:00
parent e9bccefbb5
commit 1ddb3b70f5
1 changed files with 15 additions and 10 deletions

View File

@ -1,8 +1,6 @@
(ns commiteth.routes.webhooks (ns commiteth.routes.webhooks
(:require (:require
;; TODO(oskarth): Don't use :refer :all (not sure where services.clj functions come from so importing both. [ring.util.http-response :refer [internal-server-error]]
[ring.util.http-response :refer :all]
[compojure.api.sweet :refer :all]
[cheshire.core :as json] [cheshire.core :as json]
[clojure.string :as str :refer [join]] [clojure.string :as str :refer [join]]
[clojure.tools.logging :as log] [clojure.tools.logging :as log]
@ -14,8 +12,10 @@
[users :as users]] [users :as users]]
[commiteth.github.core :as github] [commiteth.github.core :as github]
[commiteth.util.digest :refer [hex-hmac-sha1]] [commiteth.util.digest :refer [hex-hmac-sha1]]
;; TODO(oskarth): Bad form, put whitelist in better namespace ;; TODO(oskarth): Bad form, put these in better namespace
[commiteth.routes.services :refer [user-whitelisted?]] [commiteth.routes.services :refer
[user-whitelisted?
add-bounties-for-existing-issues?]]
[compojure.core :refer [defroutes POST]] [compojure.core :refer [defroutes POST]]
[crypto.equality :as crypto] [crypto.equality :as crypto]
[ring.util.http-response :refer [ok forbidden]] [ring.util.http-response :refer [ok forbidden]]
@ -263,15 +263,20 @@
:else :else
(try (try
(let [_ (log/info "handle-add-repo pre-create") (let [_ (log/info "handle-add-repo pre-create")
db-item (repositories/create (merge params {:user_id user-id db-item (repositories/create
:owner owner})) {:id repo-id ;; XXX: Being rename twice... silly.
:name repo ;; XXX: Is this name of repo?
:owner-avatar-url owner-avatar-url
:user_id user-id
:owner owner})
_ (log/info "handle-add-repo db-item" db-item)
is-enabled (= 2 (:state db-item))] is-enabled (= 2 (:state db-item))]
(if is-enabled (if is-enabled
(disable-repo-2 repo-id full-repo) (disable-repo-2 repo-id full-repo)
(enable-repo-2 repo-id full-repo)) (enable-repo-2 repo-id full-repo))
(ok (merge (ok {:enabled (not is-enabled)
{:enabled (not is-enabled)} :id repo-id
(select-keys params [:id :full_name])))) :full_name full-repo}))
(catch Exception e (catch Exception e
(log/error "exception when enabling repo" e) (log/error "exception when enabling repo" e)
(repositories/update-repo repo-id {:state -1}) (repositories/update-repo repo-id {:state -1})