diff --git a/app/models/channel/filter/bounce_check.rb b/app/models/channel/filter/bounce_check.rb index 64b77dfd5..c6cacaece 100644 --- a/app/models/channel/filter/bounce_check.rb +++ b/app/models/channel/filter/bounce_check.rb @@ -17,11 +17,10 @@ module Channel::Filter::BounceCheck next if !result[:message_id] message_id_md5 = Digest::MD5.hexdigest(result[:message_id]) article = Ticket::Article.where(message_id_md5: message_id_md5).order('created_at DESC, id DESC').limit(1).first - if article - Rails.logger.debug "Follow up for '##{article.ticket.number}' in bounce email." - mail[ 'x-zammad-ticket-id'.to_sym ] = article.ticket_id - return true - end + next if !article + Rails.logger.debug "Follow up for '##{article.ticket.number}' in bounce email." + mail[ 'x-zammad-ticket-id'.to_sym ] = article.ticket_id + return true } end diff --git a/app/models/channel/filter/follow_up_check.rb b/app/models/channel/filter/follow_up_check.rb index bdf573578..d310978f2 100644 --- a/app/models/channel/filter/follow_up_check.rb +++ b/app/models/channel/filter/follow_up_check.rb @@ -31,11 +31,10 @@ module Channel::Filter::FollowUpCheck mail[:attachments].each {|attachment| next if !attachment[:data] ticket = Ticket::Number.check(attachment[:data]) - if ticket - Rails.logger.debug "Follow up for '##{ticket.number}' in attachment." - mail[ 'x-zammad-ticket-id'.to_sym ] = ticket.id - return true - end + next if !ticket + Rails.logger.debug "Follow up for '##{ticket.number}' in attachment." + mail[ 'x-zammad-ticket-id'.to_sym ] = ticket.id + return true } end @@ -55,16 +54,15 @@ module Channel::Filter::FollowUpCheck end if references != '' message_ids = references.split(/\s+/) - sender_type_agent = Ticket::Article::Sender.lookup(name:'Agent') - sender_type_system = Ticket::Article::Sender.lookup(name:'System') + sender_type_agent = Ticket::Article::Sender.lookup(name: 'Agent') + sender_type_system = Ticket::Article::Sender.lookup(name: 'System') message_ids.each {|message_id| message_id_md5 = Digest::MD5.hexdigest(message_id) article = Ticket::Article.where(message_id_md5: message_id_md5, sender_id: [sender_type_agent.id, sender_type_system.id]).order('created_at DESC, id DESC').limit(1).first - if article - Rails.logger.debug "Follow up for '##{article.ticket.number}' in references." - mail[ 'x-zammad-ticket-id'.to_sym ] = article.ticket_id - return true - end + next if !article + Rails.logger.debug "Follow up for '##{article.ticket.number}' in references." + mail[ 'x-zammad-ticket-id'.to_sym ] = article.ticket_id + return true } end end