BigW Consortium Gitlab
Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gitlab-ce
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Forest Godfrey
gitlab-ce
Commits
3d416f16
Unverified
Commit
3d416f16
authored
Jun 02, 2015
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Create activity event and execute hooks on web editor commit
Signed-off-by:
Dmitriy Zaporozhets
<
dmitriy.zaporozhets@gmail.com
>
parent
2c403dfd
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
11 additions
and
3 deletions
+11
-3
base_service.rb
app/services/files/base_service.rb
+6
-0
create_service.rb
app/services/files/create_service.rb
+3
-2
update_service.rb
app/services/files/update_service.rb
+2
-1
No files found.
app/services/files/base_service.rb
View file @
3d416f16
...
...
@@ -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
app/services/files/create_service.rb
View file @
3d416f16
...
...
@@ -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"
)
...
...
app/services/files/update_service.rb
View file @
3d416f16
...
...
@@ -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
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment