Prevent duplicate merge events

This commit is contained in:
Dmitriy Zaporozhets 2013-02-27 17:48:51 +02:00
parent 3c5954b8c8
commit b3d648b4e8
2 changed files with 15 additions and 8 deletions

View file

@ -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