gitlabhq/app/observers/users_project_observer.rb

28 lines
619 B
Ruby
Raw Normal View History

class UsersProjectObserver < BaseObserver
2012-09-03 19:48:38 +02:00
def after_commit(users_project)
return if users_project.destroyed?
end
2012-09-09 22:18:28 +02:00
2012-09-10 08:19:15 +02:00
def after_create(users_project)
2012-09-09 22:18:28 +02:00
Event.create(
project_id: users_project.project.id,
2013-02-13 12:48:16 +01:00
action: Event::JOINED,
2012-09-09 22:18:28 +02:00
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
2012-09-09 23:27:47 +02:00
def after_destroy(users_project)
Event.create(
2012-09-15 00:00:59 +02:00
project_id: users_project.project.id,
2013-02-13 12:48:16 +01:00
action: Event::LEFT,
2012-09-09 23:27:47 +02:00
author_id: users_project.user.id
)
end
end