Moved to background jobs for mail sending.
This commit is contained in:
parent
eb47a0c2c8
commit
eb0a4bd7a9
1 changed files with 56 additions and 47 deletions
|
@ -17,6 +17,13 @@ class Observer::Ticket::Article::CommunicateEmail < ActiveRecord::Observer
|
|||
type = Ticket::Article::Type.lookup( :id => record.ticket_article_type_id )
|
||||
return if type['name'] != 'email'
|
||||
|
||||
Delayed::Job.enqueue( Observer::Ticket::Article::CommunicateEmail::Send.new( record.id )
|
||||
end
|
||||
|
||||
class Send < Struct.new( :id )
|
||||
def perform
|
||||
record = Ticket::Article.find( id )
|
||||
|
||||
# build subject
|
||||
ticket = Ticket.lookup( :id => record.ticket_id )
|
||||
subject = ticket.subject_build( record.subject )
|
||||
|
@ -69,4 +76,6 @@ class Observer::Ticket::Article::CommunicateEmail < ActiveRecord::Observer
|
|||
)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
end
|
Loading…
Reference in a new issue