Split each notification recipient into one record.
This commit is contained in:
parent
372e185dc0
commit
a304744b3f
1 changed files with 6 additions and 12 deletions
|
@ -137,12 +137,12 @@ class Observer::Ticket::Notification::BackgroundJob
|
||||||
|
|
||||||
# ignore email channel notificaiton and empty emails
|
# ignore email channel notificaiton and empty emails
|
||||||
if !channels['email'] && (!user.email || user.email == '')
|
if !channels['email'] && (!user.email || user.email == '')
|
||||||
add_recipient_list(recipient_list, user, channels)
|
add_recipient_list(ticket, user, used_channels)
|
||||||
next
|
next
|
||||||
end
|
end
|
||||||
|
|
||||||
used_channels.push 'email'
|
used_channels.push 'email'
|
||||||
recipient_list = add_recipient_list(recipient_list, user, used_channels)
|
add_recipient_list(ticket, user, used_channels)
|
||||||
|
|
||||||
# get user based notification template
|
# get user based notification template
|
||||||
# if create, send create message / block update messages
|
# if create, send create message / block update messages
|
||||||
|
@ -181,9 +181,11 @@ class Observer::Ticket::Notification::BackgroundJob
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
# add history record
|
end
|
||||||
return if recipient_list == ''
|
|
||||||
|
|
||||||
|
def add_recipient_list(ticket, user, channels)
|
||||||
|
return if channels.empty?
|
||||||
|
recipient_list = "#{user.email}(#{channels.join(',')})"
|
||||||
History.add(
|
History.add(
|
||||||
o_id: ticket.id,
|
o_id: ticket.id,
|
||||||
history_type: 'notification',
|
history_type: 'notification',
|
||||||
|
@ -193,14 +195,6 @@ class Observer::Ticket::Notification::BackgroundJob
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
def add_recipient_list(recipient_list, user, channels)
|
|
||||||
return recipient_list if channels.empty?
|
|
||||||
if recipient_list != ''
|
|
||||||
recipient_list += ','
|
|
||||||
end
|
|
||||||
recipient_list += "#{user.email}(#{channels.join(',')})"
|
|
||||||
end
|
|
||||||
|
|
||||||
def human_changes(user, record)
|
def human_changes(user, record)
|
||||||
|
|
||||||
return {} if !@p[:changes]
|
return {} if !@p[:changes]
|
||||||
|
|
Loading…
Reference in a new issue