gitlab-org--gitlab-foss/app/observers/users_project_observer.rb

23 lines
554 B
Ruby
Raw Normal View History

class UsersProjectObserver < ActiveRecord::Observer
2012-09-03 13:48:38 -04:00
def after_commit(users_project)
return if users_project.destroyed?
Notify.project_access_granted_email(users_project.id).deliver
end
2012-09-09 16:18:28 -04:00
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,
action: Event::Joined,
author_id: users_project.user.id
)
end
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,
action: Event::Left,
2012-09-09 17:27:47 -04:00
author_id: users_project.user.id
)
end
end