Commit c1dd31cf authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets

Enable UsersGroup observer, Add group_member methods to NotificationService

parent 8589824f
......@@ -148,6 +148,14 @@ class NotificationService
mailer.project_access_granted_email(users_project.id)
end
def new_group_member(users_group)
mailer.group_access_granted_email(users_group.id)
end
def update_group_member(users_group)
mailer.group_access_granted_email(users_group.id)
end
protected
# Get project users with WATCH notification level
......
......@@ -32,6 +32,7 @@ module Gitlab
:project_observer,
:system_hook_observer,
:user_observer,
:users_group_observer,
:users_project_observer
# Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
......
......@@ -347,4 +347,24 @@ describe Notify do
end
end
end
describe 'group access changed' do
let(:group) { create(:group) }
let(:user) { create(:user) }
let(:membership) { create(:users_group, group: group, user: user) }
subject { Notify.group_access_granted_email(membership.id) }
it 'has the correct subject' do
should have_subject /access to group was granted/
end
it 'contains name of project' do
should have_body_text /#{group.name}/
end
it 'contains new user role' do
should have_body_text /#{membership.human_access}/
end
end
end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment