2011-12-13 01:03:26 +01:00
|
|
|
class PostReceive
|
2012-01-03 23:42:14 +01:00
|
|
|
@queue = :post_receive
|
|
|
|
|
2012-02-29 21:38:24 +01:00
|
|
|
def self.perform(reponame, oldrev, newrev, ref, author_key_id)
|
2011-12-14 17:38:52 +01:00
|
|
|
project = Project.find_by_path(reponame)
|
|
|
|
return false if project.nil?
|
|
|
|
|
2012-02-29 22:04:09 +01:00
|
|
|
# Ignore push from non-gitlab users
|
|
|
|
return false unless Key.find_by_identifier(author_key_id)
|
|
|
|
|
2012-03-14 23:57:43 +01:00
|
|
|
# Create push event
|
2012-02-29 21:38:24 +01:00
|
|
|
project.observe_push(oldrev, newrev, ref, author_key_id)
|
2012-03-14 23:57:43 +01:00
|
|
|
|
|
|
|
# Close merged MR
|
|
|
|
project.update_merge_requests(oldrev, newrev, ref, author_key_id)
|
|
|
|
|
|
|
|
# Execute web hooks
|
2012-02-29 21:38:24 +01:00
|
|
|
project.execute_web_hooks(oldrev, newrev, ref, author_key_id)
|
2011-12-13 01:03:26 +01:00
|
|
|
end
|
|
|
|
end
|