forked from joemasilotti/railsdevs.com
-
Notifications
You must be signed in to change notification settings - Fork 0
/
admin_mailer.rb
72 lines (52 loc) · 2 KB
/
admin_mailer.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
class AdminMailer < ApplicationMailer
def new_developer
@notification = params[:record].to_notification
recipient = params[:recipient]
@developer = @notification.developer
mail(to: recipient.email, subject: @notification.email_subject)
end
def new_business
@notification = params[:record].to_notification
recipient = params[:recipient]
@business = @notification.business
mail(to: recipient.email, subject: @notification.email_subject)
end
def new_conversation
@notification = params[:record].to_notification
recipient = params[:recipient]
conversation = @notification.conversation
@business = conversation.business
@developer = conversation.developer
@subscriptions = @business.user.subscriptions
@message = conversation.messages.first
mail(to: recipient.email, subject: @notification.email_subject)
end
def potential_hire
@notification = params[:record].to_notification
recipient = params[:recipient]
@developer = @notification.developer
@conversations = @developer.conversations.count
@replies = @developer.messages.distinct.count(:conversation_id)
mail(to: recipient.email, subject: @notification.email_subject)
end
def subscription_change
@notification = params[:record].to_notification
recipient = params[:recipient]
@business = @notification.subscription.customer.owner.business
mail(to: recipient.email, subject: @notification.title)
end
def businesses_hiring_invoice_request
@notification = params[:record].to_notification
recipient = params[:recipient]
@form = @notification.hiring_invoice_request
@business = @form.business
mail(to: recipient.email, subject: @notification.title)
end
def developers_celebration_package_request
@notification = params[:record].to_notification
recipient = params[:recipient]
@form = @notification.celebration_package_request
@developer = @form.developer
mail(to: recipient.email, subject: @notification.title)
end
end