2013-03-26 12:11:38 -04:00
|
|
|
class UsersProjectObserver < BaseObserver
|
2012-09-10 02:19:15 -04:00
|
|
|
def after_create(users_project)
|
2012-09-09 16:18:28 -04:00
|
|
|
Event.create(
|
|
|
|
project_id: users_project.project.id,
|
2013-02-13 06:48:16 -05:00
|
|
|
action: Event::JOINED,
|
2012-09-09 16:18:28 -04:00
|
|
|
author_id: users_project.user.id
|
|
|
|
)
|
2013-03-26 12:11:38 -04:00
|
|
|
|
|
|
|
notification.new_team_member(users_project)
|
|
|
|
end
|
|
|
|
|
|
|
|
def after_update(users_project)
|
|
|
|
notification.update_team_member(users_project)
|
2012-08-26 17:13:03 -04:00
|
|
|
end
|
2012-08-26 17:32:03 -04:00
|
|
|
|
2012-09-09 17:27:47 -04:00
|
|
|
def after_destroy(users_project)
|
|
|
|
Event.create(
|
2012-09-14 18:00:59 -04:00
|
|
|
project_id: users_project.project.id,
|
2013-02-13 06:48:16 -05:00
|
|
|
action: Event::LEFT,
|
2012-09-09 17:27:47 -04:00
|
|
|
author_id: users_project.user.id
|
|
|
|
)
|
|
|
|
end
|
2012-08-26 17:13:03 -04:00
|
|
|
end
|