From 51ccf7ce348c9394ac3ffdaef3927c6c0bd5b863 Mon Sep 17 00:00:00 2001 From: Teemu Patja Date: Wed, 1 Mar 2017 15:54:29 +0200 Subject: [PATCH] Fixed bug related to org owned repos * store org name as owner instead of logged in user when toggling a repo --- src/clj/commiteth/routes/services.clj | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/clj/commiteth/routes/services.clj b/src/clj/commiteth/routes/services.clj index 24510b2..c44e7f7 100644 --- a/src/clj/commiteth/routes/services.clj +++ b/src/clj/commiteth/routes/services.clj @@ -14,7 +14,8 @@ [clojure.tools.logging :as log] [commiteth.eth.core :as eth] [crypto.random :as random] - [clojure.set :refer [rename-keys]])) + [clojure.set :refer [rename-keys]] + [clojure.string :as str])) (defn access-error [_ _] (unauthorized {:error "unauthorized"})) @@ -66,8 +67,9 @@ {repo-id :id full-repo :full_name repo :name} params + [owner _] (str/split full-repo #"/") db-item (repositories/create (merge params {:user_id user-id - :login login})) + :login owner})) is-enabled (= 2 (:state db-item))] (if is-enabled (disable-repo repo-id full-repo (:hook_id db-item) token)