Skip to content
Browse files

fixing a bug in the fix hooks method

  • Loading branch information...
1 parent 18cecfa commit 9afd9166d66b12bad29d9e65c45687edfa3c8624 @rauhryan rauhryan committed
Showing with 7 additions and 1 deletion.
  1. +4 −0 lib/api.rb
  2. +2 −0 lib/app.rb
  3. +1 −1 stint/stint/lib/stint/pebble.rb
View
4 lib/api.rb
@@ -40,6 +40,10 @@ class API < Sinatra::Base
json pebble.close_card params[:user], params[:repo], params[:issue]
end
+ get '/:user/:repo/hooks' do
+ json :hooks => gh.repos(params[:user],params[:repo]).hooks
+ end
+
get "/token" do
return "User Token: #{encrypted_token}"
end
View
2 lib/app.rb
@@ -87,6 +87,8 @@ def protected!
user = payload["repository"]["owner"]["login"]
repo = payload["repository"]["name"]
hooks = ghee.repos(user, repo).hooks
+ .reject {|x| x["name"] != "web" }
+ .find_all {|x| ["config"]["url"].start_with? base_url}
hub.fix_hooks user, repo, hooks
puts "fixed hooks"
return json({:message => "fixed hooks"})
View
2 stint/stint/lib/stint/pebble.rb
@@ -124,7 +124,7 @@ def hook_exists(user_name, repo, token)
hook_url = uri.to_s.gsub(uri.query,"")
- return fix_hooks(user_name, repo, hooks.find_all{ |x| x["config"]["url"].start_with? hook_url})
+ return fix_hooks(user_name, repo, hooks.reject{ |x| x["name"] != "web" }.find_all{ |x| x["config"]["url"].start_with? hook_url})
end
def fix_hooks(user_name, repo, hooks)

0 comments on commit 9afd916

Please sign in to comment.
Something went wrong with that request. Please try again.