Fixed bug related to org owned repos

* store org name as owner instead of logged in user when toggling a
  repo
This commit is contained in:
Teemu Patja 2017-03-01 15:54:29 +02:00
parent f125bd6244
commit 51ccf7ce34
No known key found for this signature in database
GPG Key ID: F5B7035E6580FD4C
1 changed files with 4 additions and 2 deletions

View File

@ -14,7 +14,8 @@
[clojure.tools.logging :as log] [clojure.tools.logging :as log]
[commiteth.eth.core :as eth] [commiteth.eth.core :as eth]
[crypto.random :as random] [crypto.random :as random]
[clojure.set :refer [rename-keys]])) [clojure.set :refer [rename-keys]]
[clojure.string :as str]))
(defn access-error [_ _] (defn access-error [_ _]
(unauthorized {:error "unauthorized"})) (unauthorized {:error "unauthorized"}))
@ -66,8 +67,9 @@
{repo-id :id {repo-id :id
full-repo :full_name full-repo :full_name
repo :name} params repo :name} params
[owner _] (str/split full-repo #"/")
db-item (repositories/create (merge params {:user_id user-id db-item (repositories/create (merge params {:user_id user-id
:login login})) :login owner}))
is-enabled (= 2 (:state db-item))] is-enabled (= 2 (:state db-item))]
(if is-enabled (if is-enabled
(disable-repo repo-id full-repo (:hook_id db-item) token) (disable-repo repo-id full-repo (:hook_id db-item) token)