Processing with note events. reformated dashboard for more events to handle

This commit is contained in:
Dmitriy Zaporozhets 2012-12-14 21:39:55 +02:00
parent 678e5355a3
commit f2db188dbe
8 changed files with 73 additions and 33 deletions

View file

@ -2,17 +2,26 @@ class ActivityObserver < ActiveRecord::Observer
observe :issue, :merge_request, :note, :milestone
def after_create(record)
Event.create(
project: record.project,
target_id: record.id,
target_type: record.class.name,
action: Event.determine_action(record),
author_id: record.author_id
)
event_author_id = record.author_id || record.author_id_of_changes
# Skip status notes
if record.kind_of?(Note) && record.note.include?("_Status changed to ")
return true
end
if event_author_id
Event.create(
project: record.project,
target_id: record.id,
target_type: record.class.name,
action: Event.determine_action(record),
author_id: event_author_id
)
end
end
def after_save(record)
if record.changed.include?("closed")
if record.changed.include?("closed") && record.author_id_of_changes
Event.create(
project: record.project,
target_id: record.id,