Module: Emails::Groups

Included in:
Notify
Defined in:
app/mailers/emails/groups.rb

Instance Method Summary collapse

Instance Method Details

#group_access_granted_email(group_member_id) ⇒ Object


3
4
5
6
7
8
9
10
11
12
# File 'app/mailers/emails/groups.rb', line 3

def group_access_granted_email(group_member_id)
  @group_member = GroupMember.find(group_member_id)
  @group = @group_member.group

  @target_url = group_url(@group)
  @current_user = @group_member.user

  mail(to: @group_member.user.notification_email,
       subject: subject("Access to group was granted"))
end

#group_invite_accepted_email(group_member_id) ⇒ Object


26
27
28
29
30
31
32
33
34
35
36
37
# File 'app/mailers/emails/groups.rb', line 26

def group_invite_accepted_email(group_member_id)
  @group_member = GroupMember.find group_member_id
  return if @group_member.created_by.nil?

  @group = @group_member.group

  @target_url = group_url(@group)
  @current_user = @group_member.created_by

  mail(to: @group_member.created_by.notification_email,
       subject: subject("Invitation accepted"))
end

#group_invite_declined_email(group_id, invite_email, access_level, created_by_id) ⇒ Object


39
40
41
42
43
44
45
46
47
48
49
50
# File 'app/mailers/emails/groups.rb', line 39

def group_invite_declined_email(group_id, invite_email, access_level, created_by_id)
  return if created_by_id.nil?

  @group = Group.find(group_id)
  @current_user = @created_by = User.find(created_by_id)
  @access_level = access_level
  @invite_email = invite_email
  
  @target_url = group_url(@group)
  mail(to: @created_by.notification_email,
       subject: subject("Invitation declined"))
end

#group_member_invited_email(group_member_id, token) ⇒ Object


14
15
16
17
18
19
20
21
22
23
24
# File 'app/mailers/emails/groups.rb', line 14

def group_member_invited_email(group_member_id, token)
  @group_member = GroupMember.find group_member_id
  @group = @group_member.group
  @token = token

  @target_url = group_url(@group)
  @current_user = @group_member.user

  mail(to: @group_member.invite_email,
       subject: "Invitation to join group #{@group.name}")
end