Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
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
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
8 deletions
+15
-8
app/models/merge_request.rb
app/models/merge_request.rb
+1
-8
app/observers/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
...
@@ -177,15 +177,8 @@ class MergeRequest < ActiveRecord::Base
end
end
def
merge!
(
user_id
)
def
merge!
(
user_id
)
self
.
author_id_of_changes
=
user_id
self
.
merge
self
.
merge
Event
.
create
(
project:
self
.
project
,
action:
Event
::
MERGED
,
target_id:
self
.
id
,
target_type:
"MergeRequest"
,
author_id:
user_id
)
end
end
def
automerge!
(
current_user
)
def
automerge!
(
current_user
)
...
...
app/observers/activity_observer.rb
View file @
b3d648b4
...
@@ -39,4 +39,18 @@ class ActivityObserver < ActiveRecord::Observer
...
@@ -39,4 +39,18 @@ class ActivityObserver < ActiveRecord::Observer
author_id:
record
.
author_id_of_changes
author_id:
record
.
author_id_of_changes
)
)
end
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
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