From 84ce3a900289860807262aacf3c98cc0c9901fd0 Mon Sep 17 00:00:00 2001 From: Martin Edenhofer Date: Mon, 14 Jul 2014 07:56:38 +0200 Subject: [PATCH] Improved error handling. --- app/models/observer/ticket/notification.rb | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/app/models/observer/ticket/notification.rb b/app/models/observer/ticket/notification.rb index 811bd96ff..1418032b2 100644 --- a/app/models/observer/ticket/notification.rb +++ b/app/models/observer/ticket/notification.rb @@ -237,13 +237,17 @@ class Observer::Ticket::Notification < ActiveRecord::Observer # add history record if recipient_list != '' + created_by_id = 1 + if article && article.created_by_id + created_by_id = article.created_by_id + end History.add( :o_id => ticket.id, :history_type => 'notification', :history_object => 'Ticket', :value_from => notification_subject, :value_to => recipient_list, - :created_by_id => article.created_by_id || 1 + :created_by_id => created_by_id ) end end