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
b3d648b4
Commit
b3d648b4
authored
Feb 27, 2013
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Prevent duplicate merge events
parent
3c5954b8
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
8 deletions
+15
-8
merge_request.rb
app/models/merge_request.rb
+1
-8
activity_observer.rb
app/observers/activity_observer.rb
+14
-0
No files found.
app/models/merge_request.rb
View file @
b3d648b4
...
...
@@ -177,15 +177,8 @@ class MergeRequest < ActiveRecord::Base
end
def
merge!
(
user_id
)
self
.
author_id_of_changes
=
user_id
self
.
merge
Event
.
create
(
project:
self
.
project
,
action:
Event
::
MERGED
,
target_id:
self
.
id
,
target_type:
"MergeRequest"
,
author_id:
user_id
)
end
def
automerge!
(
current_user
)
...
...
app/observers/activity_observer.rb
View file @
b3d648b4
...
...
@@ -39,4 +39,18 @@ class ActivityObserver < ActiveRecord::Observer
author_id:
record
.
author_id_of_changes
)
end
def
after_merge
(
record
,
transition
)
# Since MR can be merged via sidekiq
# to prevent event duplication do this check
return
true
if
record
.
merge_event
Event
.
create
(
project:
record
.
project
,
target_id:
record
.
id
,
target_type:
record
.
class
.
name
,
action:
Event
::
MERGED
,
author_id:
record
.
author_id_of_changes
)
end
end
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