Skip to content

Commit

Permalink
Merge commit 'core/fix-autoresponder' into development
Browse files Browse the repository at this point in the history
  • Loading branch information
cykod committed Aug 12, 2010
2 parents d76cf7a + bd2a113 commit 16e1557
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions app/models/trigger/core_trigger.rb
Expand Up @@ -56,13 +56,13 @@ def validate

def perform(action_data={},user = nil)

data_vars = action_data.is_a?(DomainModel) ? action_data.triggered_attributes.symbolize_keys : (action_data.is_a?(Hash) ? action_data : {})
data_vars = data_vars.symbolize_keys
data_vars = action_data.is_a?(DomainModel) ? action_data.triggered_attributes : (action_data.is_a?(Hash) ? action_data : {})
data_vars.symbolize_keys!

# Find out who we are emailing
if options.email_to == 'autorespond'
begin
emails = [ action_data.is_a?(DomainModel) ? (action_data.triggered_attributes['email'] || action_data.triggered_attributes['email_address']) : (action_data['email'] || action_data['email_address']) ]
emails = user && ! user.email.blank? ? [user.email] : [(data_vars[:email] || data_vars[:email_address])]
rescue
return false
end
Expand Down Expand Up @@ -94,7 +94,9 @@ def perform(action_data={},user = nil)
body += "</table>"
end
end


emails.reject! { |e| e.blank? }

if options.send_type == 'message'
msg_options = { :html => body }
msg_options[:from] = options.message_from unless options.message_from.blank?
Expand Down

0 comments on commit 16e1557

Please sign in to comment.