Просмотр исходного кода

Fixed issue #851 - user "-" in notification in trigger changes.

Martin Edenhofer 8 лет назад
Родитель
Сommit
30a804691b
2 измененных файлов с 10 добавлено и 3 удалено
  1. 9 2
      app/models/ticket.rb
  2. 1 1
      app/models/transaction/trigger.rb

+ 9 - 2
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,

+ 1 - 1
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