From 1ce6bd18e18d36c67cf15c9df30952b3f12ac4d5 Mon Sep 17 00:00:00 2001 From: Martin Edenhofer Date: Mon, 22 Feb 2016 11:05:33 +0100 Subject: [PATCH] Just send notification once a day (not in 24 hours turns). --- app/models/observer/ticket/notification/background_job.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/models/observer/ticket/notification/background_job.rb b/app/models/observer/ticket/notification/background_job.rb index dd5cbe060..d1bce42e2 100644 --- a/app/models/observer/ticket/notification/background_job.rb +++ b/app/models/observer/ticket/notification/background_job.rb @@ -129,7 +129,7 @@ class Observer::Ticket::Notification::BackgroundJob changes = human_changes(user, ticket) 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' identifier = user.email if !identifier || identifier == '' @@ -140,7 +140,7 @@ class Observer::Ticket::Notification::BackgroundJob next if history['type'] != 'notification' next if history['value_to'] !~ /\(#{Regexp.escape(@p[:type])}:/ 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 } next if already_notified