Skip to content

Commit

Permalink
Upgrades to newest ghee gem, makes the necessary method changes
Browse files Browse the repository at this point in the history
  • Loading branch information
discorick committed Mar 5, 2015
1 parent 2bdfa17 commit 011268b
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 10 deletions.
2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ gem 'rack-no-www'
gem 'rdiscount'
gem 'warden-github', :github => "atmos/warden-github"
gem 'warden_strategies'
gem 'ghee', '~> 0.11.16'
gem 'ghee', '~> 0.12.16'
gem 'rack-ssl'
gem 'addressable'
gem 'kgio'
Expand Down
6 changes: 3 additions & 3 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ GEM
eventmachine (>= 1.0.0.beta.4)
encryptor (1.1.3)
erubis (2.7.0)
ethon (0.7.2)
ethon (0.7.3)
ffi (>= 1.3.0)
eventmachine (1.0.4)
excon (0.41.0)
Expand Down Expand Up @@ -200,7 +200,7 @@ GEM
dotenv (~> 0.11.1)
thor (~> 0.19.1)
formatador (0.2.5)
ghee (0.11.16)
ghee (0.12.16)
faraday (~> 0.9)
faraday_middleware (~> 0.9)
hashie (~> 3.3.2)
Expand Down Expand Up @@ -367,7 +367,7 @@ DEPENDENCIES
faye-huboard
faye-redis
foreman
ghee (~> 0.11.16)
ghee (~> 0.12.16)
i18n
kgio
memcachier
Expand Down
2 changes: 1 addition & 1 deletion app/routes/api/profiles.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ class Profiles < Base

get '/api/profiles/?' do
user = gh.user.to_hash
orgs = gh.user.memberships.orgs("active").body
orgs = gh.user.memberships

orgs.select!{|org| org["role"] == "admin"}
orgs.map!{|org| org = org["organization"]}
Expand Down
2 changes: 1 addition & 1 deletion app/routes/profiles.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ def protected!
if account_type == "User"
is_admin = gh.user["login"] == @user
elsif account_type == "Organization"
orgs = gh.user.memberships.orgs("active").body
orgs = gh.user.memberships
orgs_list = orgs.select{|org| org["role"] == "admin"}
is_admin = orgs_list.any?{|org| org["organization"]["login"] == @user }
end
Expand Down
7 changes: 3 additions & 4 deletions lib/use_cases/private_repo.rb
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,9 @@ def has_subscription?(params)
:private
def user_is_owner(params)
if @repo_owner["type"] == "Organization"
@u ||= @gh.orgs(@repo_owner["login"]).memberships(@gh.user["login"]) do |req|
req.headers["Accept"] = "application/vnd.github.moondragon+json"
end
return @u["role"] == "admin"
@user ||= @gh.orgs(@repo_owner["login"])
.memberships(@gh.user["login"])
return @user["role"] == "admin"
end
@repo_owner['login'] == @gh.user['login']
end
Expand Down

0 comments on commit 011268b

Please sign in to comment.