Create activity event and execute hooks on web editor commit

Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
This commit is contained in:
Dmitriy Zaporozhets 2015-06-02 10:45:13 +02:00
parent 2c403dfd92
commit 3d416f1682
No known key found for this signature in database
GPG Key ID: 627C5F589F467F17
3 changed files with 11 additions and 3 deletions

View File

@ -13,5 +13,11 @@ module Files
def repository
project.repository
end
def after_commit(sha)
commit = repository.commit(sha)
full_ref = 'refs/heads/' + (params[:new_branch] || ref)
GitPushService.new.execute(project, current_user, commit.parent_id, sha, full_ref)
end
end
end

View File

@ -40,7 +40,7 @@ module Files
params[:content]
end
created_successfully = repository.commit_file(
sha = repository.commit_file(
current_user,
file_path,
content,
@ -49,7 +49,8 @@ module Files
)
if created_successfully
if sha
after_commit(sha)
success
else
error("Your changes could not be committed, because the file has been changed")

View File

@ -26,7 +26,7 @@ module Files
params[:content]
end
repository.commit_file(
sha = repository.commit_file(
current_user,
path,
content,
@ -34,6 +34,7 @@ module Files
params[:new_branch] || ref
)
after_commit(sha)
success
rescue Gitlab::Satellite::CheckoutFailed => ex
error("Your changes could not be committed because ref '#{ref}' could not be checked out", 400)