diff --git a/src/clj/commiteth/bounties.clj b/src/clj/commiteth/bounties.clj index aed82e2..8e0c01c 100644 --- a/src/clj/commiteth/bounties.clj +++ b/src/clj/commiteth/bounties.clj @@ -17,15 +17,14 @@ (defn add-bounty-for-issue [repo repo-id login issue] - (log/debug "add-bounty-for-issue" issue) (let [{issue-id :id issue-number :number issue-title :title} issue created-issue (issues/create repo-id issue-id issue-number issue-title) - repo-owner (:address (users/get-repo-owner repo-id))] + repo-owner-address (:address (users/get-repo-owner repo-id))] (log/info (format "Issue %s/%s/%s labeled as bounty" login repo issue-number)) (if (= 1 created-issue) - (let [transaction-hash (eth/deploy-contract repo-owner)] + (let [transaction-hash (eth/deploy-contract repo-owner-address)] (log/info "Contract deployed, transaction-hash:" transaction-hash ) (issues/update-transaction-hash issue-id transaction-hash)) (log/debug "Issue already exists in DB, ignoring")))) @@ -34,7 +33,6 @@ (defn add-bounties-for-existing-issues [repo repo-id login] (let [issues (github/get-issues login repo) bounty-issues (filter has-bounty-label? issues)] - (log/debug bounty-issues) (log/debug "adding bounties for" (count bounty-issues) " existing issues") (doall diff --git a/src/clj/commiteth/db/users.clj b/src/clj/commiteth/db/users.clj index 850b567..6493a89 100644 --- a/src/clj/commiteth/db/users.clj +++ b/src/clj/commiteth/db/users.clj @@ -1,6 +1,7 @@ (ns commiteth.db.users (:require [commiteth.db.core :refer [*db*] :as db] - [clojure.java.jdbc :as jdbc]) + [clojure.java.jdbc :as jdbc] + [clojure.tools.logging :as log]) (:import [java.util Date])) (defn create-user @@ -28,6 +29,7 @@ (defn update-user-address [user-id address] + (log/debug "update-user-address" user-id address) (jdbc/with-db-connection [con-db *db*] (db/update-user-address! con-db {:id user-id :address address}))) diff --git a/src/clj/commiteth/routes/services.clj b/src/clj/commiteth/routes/services.clj index 84d262c..5d31eaf 100644 --- a/src/clj/commiteth/routes/services.clj +++ b/src/clj/commiteth/routes/services.clj @@ -30,27 +30,27 @@ (update-in acc [:letks] into [binding `(:identity ~'+compojure-api-request+)])) -(defn enable-repo [repo-id repo login token] +(defn enable-repo [repo-id repo full-repo login token] (log/debug "enable-repo" repo-id repo) (let [hook-secret (random/base64 32)] (try (repositories/update-repo repo-id {:state 1 :hook_secret hook-secret}) - (let [created-hook (github/add-webhook repo token hook-secret)] + (let [created-hook (github/add-webhook full-repo token hook-secret)] (log/debug "Created webhook:" created-hook) - (github/create-label repo token) + (github/create-label full-repo token) (repositories/update-repo repo-id {:state 2 :hook_id (:id created-hook)}) (bounties/add-bounties-for-existing-issues repo repo-id login)) (catch Exception e - (log/info "exception when creating webhook" (.getMessage e)) + (log/info "exception when creating webhook" (.getMessage e) e) (repositories/update-repo repo-id {:state -1}))))) -(defn disable-repo [repo-id repo hook-id token] - (log/debug "disable-repo" repo-id repo) +(defn disable-repo [repo-id full-repo hook-id token] + (log/debug "disable-repo" repo-id full-repo) (do - (github/remove-webhook repo hook-id token) + (github/remove-webhook full-repo hook-id token) (repositories/update-repo repo-id {:hook_secret "" :state 0 :hook_id nil}))) @@ -62,13 +62,14 @@ login :login user-id :id} user {repo-id :id - repo :full_name} params + full-repo :full_name + repo :name} params db-item (repositories/create (merge params {:user_id user-id :login login})) is-enabled (= 2 (:state db-item))] (if is-enabled - (disable-repo repo-id repo (:hook_id db-item) token) - (enable-repo repo-id repo login token)) + (disable-repo repo-id full-repo (:hook_id db-item) token) + (enable-repo repo-id repo full-repo login token)) (merge {:enabled (not is-enabled)} (select-keys params [:id :full_name])))) @@ -108,9 +109,9 @@ (ok {:user (users/get-user (:id user))})) (POST "/address" [] :auth-rules authenticated? - :body-params [user-id :- String, address :- String] + :body-params [user-id :- Long, address :- String] :summary "Update user address" - (let [result (users/update-user-address (Integer/parseInt user-id) address)] + (let [result (users/update-user-address user-id address)] (if (= 1 result) (ok) (internal-server-error)))) diff --git a/src/clj/commiteth/routes/webhooks.clj b/src/clj/commiteth/routes/webhooks.clj index 979bbd7..164fff9 100644 --- a/src/clj/commiteth/routes/webhooks.clj +++ b/src/clj/commiteth/routes/webhooks.clj @@ -46,7 +46,7 @@ repo-name :name {login :login} :owner} (:repository webhook-payload) repo-map {:repo repo-name :login login :repo_id repo-id}] - (bounties/add-bounty-for-issue repo-map issue))) + (bounties/add-bounty-for-issue repo-name repo-id issue))) (defn handle-issue-closed ;; TODO: does not work in case the issue is closed on github web ui diff --git a/src/cljs/commiteth/activity.cljs b/src/cljs/commiteth/activity.cljs index 4e1a240..c1d93ad 100644 --- a/src/cljs/commiteth/activity.cljs +++ b/src/cljs/commiteth/activity.cljs @@ -3,4 +3,5 @@ (defn activity-page [] (fn [] - [:div "This will be the activity view"])) + [:div.ui.container + [:div.ui.text "This will be the activity view"]])) diff --git a/src/cljs/commiteth/bounties.cljs b/src/cljs/commiteth/bounties.cljs index ff17b15..495b247 100644 --- a/src/cljs/commiteth/bounties.cljs +++ b/src/cljs/commiteth/bounties.cljs @@ -3,4 +3,5 @@ (defn bounties-page [] (fn [] - [:div "Bounties view not implemented"])) + [:div.ui.container + [:div.ui.text "Bounties view coming soon"]])) diff --git a/src/cljs/commiteth/manage.cljs b/src/cljs/commiteth/manage.cljs index f138e5e..019cc46 100644 --- a/src/cljs/commiteth/manage.cljs +++ b/src/cljs/commiteth/manage.cljs @@ -1,6 +1,6 @@ (ns commiteth.manage (:require [re-frame.core :as rf] - [commiteth.common :refer [input checkbox]] + [commiteth.common :refer [input]] [commiteth.issues :refer [issues-list-table issue-url]] [clojure.set :refer [rename-keys]])) @@ -16,7 +16,7 @@ ^{:key repo-id} [:div.d-table.width-full [:div.d-table.col-12.width-full.py-4.border-bottom.issue - [checkbox {:value-path [:enabled-repos repo-id] + #_[checkbox {:value-path [:enabled-repos repo-id] :style {:width 32 :margin-left 10} :on-change #(rf/dispatch [:toggle-repo repo])}] [:div.d-table-cell.col-11.pr-3.v-align-top diff --git a/src/cljs/commiteth/repos.cljs b/src/cljs/commiteth/repos.cljs index 3be08be..e064f17 100644 --- a/src/cljs/commiteth/repos.cljs +++ b/src/cljs/commiteth/repos.cljs @@ -21,7 +21,7 @@ (defn repo-card [repo] [:div.ui.card [:div.content - [:div.repo-label (:full_name repo)] + [:div.repo-label [:a {:href (:html_url repo)} (:full_name repo)]] [:div.repo-description (:description repo)]] [:div.repo-button-container [repo-toggle-button diff --git a/src/cljs/commiteth/update_address.cljs b/src/cljs/commiteth/update_address.cljs index 6ff0a3f..8c9af01 100644 --- a/src/cljs/commiteth/update_address.cljs +++ b/src/cljs/commiteth/update_address.cljs @@ -18,7 +18,7 @@ [:div.ui.container.grid [:div.ui.form.eight.wide.column [:h3 "Update address"] - [:p "Placeholder text for explaining what an Etheum address is."] + [:p "Placeholder text for explaining what an Ethereum address is."] [:div.field (if-not (empty? web3-accounts) [dropdown "Select address"