From 30a804691b6b388c726e2c25ff3afed9770de80f Mon Sep 17 00:00:00 2001 From: Martin Edenhofer Date: Sat, 25 Mar 2017 00:00:41 +0100 Subject: [PATCH 1/2] Fixed issue #851 - user "-" in notification in trigger changes. --- app/models/ticket.rb | 11 +++++++++-- app/models/transaction/trigger.rb | 2 +- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/app/models/ticket.rb b/app/models/ticket.rb index 8034b67e3..213405800 100644 --- a/app/models/ticket.rb +++ b/app/models/ticket.rb @@ -715,8 +715,15 @@ perform changes on ticket group = self.group next if !group email_address = group.email_address - next if !email_address - next if !email_address.channel_id + if !email_address + logger.info "Unable to send trigger based notification to #{recipient_string} because no email address is set for group '#{group.name}'" + next + end + + if !email_address.channel_id + logger.info "Unable to send trigger based notification to #{recipient_string} because no channel is set for email address '#{email_address.email}' (id: #{email_address.id})" + next + end objects = { ticket: self, diff --git a/app/models/transaction/trigger.rb b/app/models/transaction/trigger.rb index 46408051d..33a504b72 100644 --- a/app/models/transaction/trigger.rb +++ b/app/models/transaction/trigger.rb @@ -44,7 +44,7 @@ class Transaction::Trigger original_user_id = UserInfo.current_user_id - Transaction.execute(reset_user_id: true, disable: ['Transaction::Trigger']) do + Transaction.execute(reset_user_id: true, disable: ['Transaction::Trigger', 'Transaction::Notification']) do triggers.each { |trigger| condition = trigger.condition From ec6aaa64d5b4c760ee93f0c2f54518ce71f43722 Mon Sep 17 00:00:00 2001 From: Martin Edenhofer Date: Sat, 25 Mar 2017 01:12:57 +0100 Subject: [PATCH 2/2] Updated new test result. --- test/integration/clearbit_test.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/test/integration/clearbit_test.rb b/test/integration/clearbit_test.rb index 81c2ef64a..6da9f0eb1 100644 --- a/test/integration/clearbit_test.rb +++ b/test/integration/clearbit_test.rb @@ -273,7 +273,8 @@ class ClearbitTest < ActiveSupport::TestCase assert_equal('', customer6_lookup.lastname) assert_equal('', customer6_lookup.note) assert_equal('http://clearbit.com', customer6_lookup.web) - assert_equal('3030 16th St, San Francisco, CA 94103, USA', customer6_lookup.address) + #assert_equal('3030 16th St, San Francisco, CA 94103, USA', customer6_lookup.address) + assert_equal('San Francisco, CA, USA', customer6_lookup.address) organization6_lookup = Organization.find_by(name: 'Clearbit') assert(ExternalSync.find_by(source: 'clearbit', object: 'Organization', o_id: organization6_lookup.id))