Reduced complexity (not needed code).

This commit is contained in:
Martin Edenhofer 2016-08-23 08:35:23 +02:00
parent e4a731dcad
commit 42b45e50c1

View file

@ -8,19 +8,15 @@ module Channel::Filter::IdentifySender
customer_user = nil
if !customer_user_id.empty?
customer_user = User.lookup(id: customer_user_id)
if !customer_user
Rails.logger.debug "Invalid x-zammad-customer-id header '#{customer_user_id}', no such user."
else
Rails.logger.debug "Took customer form x-zammad-customer-id header '#{customer_user_id}'."
if customer_user
create_recipients(mail)
return
end
Rails.logger.debug "Took customer form x-zammad-customer-id header '#{customer_user_id}'."
else
Rails.logger.debug "Invalid x-zammad-customer-id header '#{customer_user_id}', no such user."
end
end
# check if sender exists in database
if !mail[ 'x-zammad-customer-login'.to_sym ].empty?
if !customer_user && !mail[ 'x-zammad-customer-login'.to_sym ].empty?
customer_user = User.find_by(login: mail[ 'x-zammad-customer-login'.to_sym ])
end
if !customer_user && !mail[ 'x-zammad-customer-email'.to_sym ].empty?