Fixed notifiaction.

This commit is contained in:
Martin Edenhofer 2014-08-26 10:18:59 +02:00
parent 9ad5ebf0d3
commit 8cdcea5f63
2 changed files with 4 additions and 3 deletions

View file

@ -177,6 +177,7 @@ class Observer::Ticket::Notification < ActiveRecord::Observer
params = { params = {
:ticket_id => ticket.id, :ticket_id => ticket.id,
:article_id => article.id, :article_id => article.id,
:type => type,
:data => data, :data => data,
} }
Delayed::Job.enqueue( Observer::Ticket::Notification::BackgroundJob.new( params ) ) Delayed::Job.enqueue( Observer::Ticket::Notification::BackgroundJob.new( params ) )

View file

@ -2,6 +2,7 @@ class Observer::Ticket::Notification::BackgroundJob
def initialize(params) def initialize(params)
@ticket_id = params[:ticket_id] @ticket_id = params[:ticket_id]
@article_id = params[:article_id] @article_id = params[:article_id]
@type = params[:type]
@data = params[:data] @data = params[:data]
end end
def perform def perform
@ -42,13 +43,12 @@ class Observer::Ticket::Notification::BackgroundJob
recipient_list = '' recipient_list = ''
notification_subject = '' notification_subject = ''
recipients.each do |user| recipients.each do |user|
OnlineNotification.add( OnlineNotification.add(
:type => type, :type => @type,
:object => 'Ticket', :object => 'Ticket',
:o_id => ticket.id, :o_id => ticket.id,
:seen => false, :seen => false,
:created_by_id => UserInfo.current_user_id || 1, :created_by_id => article.created_by_id || 1,
:user_id => user.id, :user_id => user.id,
) )