2012-08-26 23:13:03 +02:00
|
|
|
class UsersProjectObserver < ActiveRecord::Observer
|
|
|
|
def after_create(users_project)
|
|
|
|
Notify.project_access_granted_email(users_project.id).deliver
|
2012-09-09 22:18:28 +02:00
|
|
|
|
|
|
|
Event.create(
|
|
|
|
project_id: users_project.project.id,
|
|
|
|
action: Event::Joined,
|
|
|
|
author_id: users_project.user.id
|
|
|
|
)
|
2012-08-26 23:13:03 +02:00
|
|
|
end
|
2012-08-26 23:32:03 +02:00
|
|
|
|
|
|
|
def after_update(users_project)
|
|
|
|
Notify.project_access_granted_email(users_project.id).deliver
|
|
|
|
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,
|
|
|
|
action: Event::Left,
|
2012-09-09 23:27:47 +02:00
|
|
|
author_id: users_project.user.id
|
|
|
|
)
|
|
|
|
end
|
2012-08-26 23:13:03 +02:00
|
|
|
end
|