gitlabhq/app/observers/users_project_observer.rb
2013-03-26 18:11:38 +02:00

27 lines
619 B
Ruby

class UsersProjectObserver < BaseObserver
def after_commit(users_project)
return if users_project.destroyed?
end
def after_create(users_project)
Event.create(
project_id: users_project.project.id,
action: Event::JOINED,
author_id: users_project.user.id
)
notification.new_team_member(users_project)
end
def after_update(users_project)
notification.update_team_member(users_project)
end
def after_destroy(users_project)
Event.create(
project_id: users_project.project.id,
action: Event::LEFT,
author_id: users_project.user.id
)
end
end