Just send notification once a day (not in 24 hours turns).
This commit is contained in:
parent
0dd0288cb0
commit
1ce6bd18e1
1 changed files with 2 additions and 2 deletions
|
@ -129,7 +129,7 @@ class Observer::Ticket::Notification::BackgroundJob
|
||||||
changes = human_changes(user, ticket)
|
changes = human_changes(user, ticket)
|
||||||
next if @p[:type] == 'update' && !article && ( !changes || changes.empty? )
|
next if @p[:type] == 'update' && !article && ( !changes || changes.empty? )
|
||||||
|
|
||||||
# check if today already notified within last 24 hours
|
# check if today already notified
|
||||||
if @p[:type] == 'reminder_reached' || @p[:type] == 'escalation'
|
if @p[:type] == 'reminder_reached' || @p[:type] == 'escalation'
|
||||||
identifier = user.email
|
identifier = user.email
|
||||||
if !identifier || identifier == ''
|
if !identifier || identifier == ''
|
||||||
|
@ -140,7 +140,7 @@ class Observer::Ticket::Notification::BackgroundJob
|
||||||
next if history['type'] != 'notification'
|
next if history['type'] != 'notification'
|
||||||
next if history['value_to'] !~ /\(#{Regexp.escape(@p[:type])}:/
|
next if history['value_to'] !~ /\(#{Regexp.escape(@p[:type])}:/
|
||||||
next if history['value_to'] !~ /#{Regexp.escape(identifier)}\(/
|
next if history['value_to'] !~ /#{Regexp.escape(identifier)}\(/
|
||||||
next if history['created_at'] < Time.zone.now - 24.hours
|
next if history['created_at'].today?
|
||||||
already_notified = true
|
already_notified = true
|
||||||
}
|
}
|
||||||
next if already_notified
|
next if already_notified
|
||||||
|
|
Loading…
Reference in a new issue