@@ -76,7 +76,7 class MailHandler < ActionMailer::Base | |||||
76 | sender_email = email.from.to_a.first.to_s.strip |
|
76 | sender_email = email.from.to_a.first.to_s.strip | |
77 | # Ignore emails received from the application emission address to avoid hell cycles |
|
77 | # Ignore emails received from the application emission address to avoid hell cycles | |
78 | if sender_email.downcase == Setting.mail_from.to_s.strip.downcase |
|
78 | if sender_email.downcase == Setting.mail_from.to_s.strip.downcase | |
79 |
if logger |
|
79 | if logger | |
80 | logger.info "MailHandler: ignoring email from Redmine emission address [#{sender_email}]" |
|
80 | logger.info "MailHandler: ignoring email from Redmine emission address [#{sender_email}]" | |
81 | end |
|
81 | end | |
82 | return false |
|
82 | return false | |
@@ -87,7 +87,7 class MailHandler < ActionMailer::Base | |||||
87 | if value |
|
87 | if value | |
88 | value = value.to_s.downcase |
|
88 | value = value.to_s.downcase | |
89 | if (ignored_value.is_a?(Regexp) && value.match(ignored_value)) || value == ignored_value |
|
89 | if (ignored_value.is_a?(Regexp) && value.match(ignored_value)) || value == ignored_value | |
90 |
if logger |
|
90 | if logger | |
91 | logger.info "MailHandler: ignoring email with #{key}:#{value} header" |
|
91 | logger.info "MailHandler: ignoring email with #{key}:#{value} header" | |
92 | end |
|
92 | end | |
93 | return false |
|
93 | return false | |
@@ -96,7 +96,7 class MailHandler < ActionMailer::Base | |||||
96 | end |
|
96 | end | |
97 | @user = User.find_by_mail(sender_email) if sender_email.present? |
|
97 | @user = User.find_by_mail(sender_email) if sender_email.present? | |
98 | if @user && !@user.active? |
|
98 | if @user && !@user.active? | |
99 |
if logger |
|
99 | if logger | |
100 | logger.info "MailHandler: ignoring email from non-active user [#{@user.login}]" |
|
100 | logger.info "MailHandler: ignoring email from non-active user [#{@user.login}]" | |
101 | end |
|
101 | end | |
102 | return false |
|
102 | return false | |
@@ -109,7 +109,7 class MailHandler < ActionMailer::Base | |||||
109 | when 'create' |
|
109 | when 'create' | |
110 | @user = create_user_from_email |
|
110 | @user = create_user_from_email | |
111 | if @user |
|
111 | if @user | |
112 |
if logger |
|
112 | if logger | |
113 | logger.info "MailHandler: [#{@user.login}] account created" |
|
113 | logger.info "MailHandler: [#{@user.login}] account created" | |
114 | end |
|
114 | end | |
115 | add_user_to_group(@@handler_options[:default_group]) |
|
115 | add_user_to_group(@@handler_options[:default_group]) | |
@@ -117,14 +117,14 class MailHandler < ActionMailer::Base | |||||
117 | Mailer.account_information(@user, @user.password).deliver |
|
117 | Mailer.account_information(@user, @user.password).deliver | |
118 | end |
|
118 | end | |
119 | else |
|
119 | else | |
120 |
if logger |
|
120 | if logger | |
121 | logger.error "MailHandler: could not create account for [#{sender_email}]" |
|
121 | logger.error "MailHandler: could not create account for [#{sender_email}]" | |
122 | end |
|
122 | end | |
123 | return false |
|
123 | return false | |
124 | end |
|
124 | end | |
125 | else |
|
125 | else | |
126 | # Default behaviour, emails from unknown users are ignored |
|
126 | # Default behaviour, emails from unknown users are ignored | |
127 |
if logger |
|
127 | if logger | |
128 | logger.info "MailHandler: ignoring email from unknown user [#{sender_email}]" |
|
128 | logger.info "MailHandler: ignoring email from unknown user [#{sender_email}]" | |
129 | end |
|
129 | end | |
130 | return false |
|
130 | return false | |
@@ -195,7 +195,7 class MailHandler < ActionMailer::Base | |||||
195 | add_watchers(issue) |
|
195 | add_watchers(issue) | |
196 | issue.save! |
|
196 | issue.save! | |
197 | add_attachments(issue) |
|
197 | add_attachments(issue) | |
198 |
logger.info "MailHandler: issue ##{issue.id} created by #{user}" if logger |
|
198 | logger.info "MailHandler: issue ##{issue.id} created by #{user}" if logger | |
199 | issue |
|
199 | issue | |
200 | end |
|
200 | end | |
201 |
|
201 | |||
@@ -224,7 +224,7 class MailHandler < ActionMailer::Base | |||||
224 | journal.notes = cleaned_up_text_body |
|
224 | journal.notes = cleaned_up_text_body | |
225 | add_attachments(issue) |
|
225 | add_attachments(issue) | |
226 | issue.save! |
|
226 | issue.save! | |
227 |
if logger |
|
227 | if logger | |
228 | logger.info "MailHandler: issue ##{issue.id} updated by #{user}" |
|
228 | logger.info "MailHandler: issue ##{issue.id} updated by #{user}" | |
229 | end |
|
229 | end | |
230 | journal |
|
230 | journal | |
@@ -257,7 +257,7 class MailHandler < ActionMailer::Base | |||||
257 | add_attachments(reply) |
|
257 | add_attachments(reply) | |
258 | reply |
|
258 | reply | |
259 | else |
|
259 | else | |
260 |
if logger |
|
260 | if logger | |
261 | logger.info "MailHandler: ignoring reply from [#{sender_email}] to a locked topic" |
|
261 | logger.info "MailHandler: ignoring reply from [#{sender_email}] to a locked topic" | |
262 | end |
|
262 | end | |
263 | end |
|
263 | end |
General Comments 0
You need to be logged in to leave comments.
Login now