##// END OF EJS Templates
remove trailing white-spaces from mailer model source....
Toshi MARUYAMA -
r5696:01c531166245
parent child
Show More
@@ -31,7 +31,7 class Mailer < ActionMailer::Base
31 31 h = h.to_s.gsub(%r{\/.*$}, '') unless Redmine::Utils.relative_url_root.blank?
32 32 { :host => h, :protocol => Setting.protocol }
33 33 end
34
34
35 35 # Builds a tmail object used to email recipients of the added issue.
36 36 #
37 37 # Example:
@@ -133,7 +133,7 class Mailer < ActionMailer::Base
133 133 :added_to_url => added_to_url
134 134 render_multipart('attachments_added', body)
135 135 end
136
136
137 137 # Builds a tmail object used to email recipients of a news' project when a news item is added.
138 138 #
139 139 # Example:
@@ -148,7 +148,7 class Mailer < ActionMailer::Base
148 148 :news_url => url_for(:controller => 'news', :action => 'show', :id => news)
149 149 render_multipart('news_added', body)
150 150 end
151
151
152 152 # Builds a tmail object used to email recipients of a news' project when a news comment is added.
153 153 #
154 154 # Example:
@@ -167,7 +167,7 class Mailer < ActionMailer::Base
167 167 render_multipart('news_comment_added', body)
168 168 end
169 169
170 # Builds a tmail object used to email the recipients of the specified message that was posted.
170 # Builds a tmail object used to email the recipients of the specified message that was posted.
171 171 #
172 172 # Example:
173 173 # message_posted(message) => tmail object
@@ -184,8 +184,8 class Mailer < ActionMailer::Base
184 184 :message_url => url_for(message.event_url)
185 185 render_multipart('message_posted', body)
186 186 end
187
188 # Builds a tmail object used to email the recipients of a project of the specified wiki content was added.
187
188 # Builds a tmail object used to email the recipients of a project of the specified wiki content was added.
189 189 #
190 190 # Example:
191 191 # wiki_content_added(wiki_content) => tmail object
@@ -201,8 +201,8 class Mailer < ActionMailer::Base
201 201 :wiki_content_url => url_for(:controller => 'wiki', :action => 'show', :project_id => wiki_content.project, :id => wiki_content.page.title)
202 202 render_multipart('wiki_content_added', body)
203 203 end
204
205 # Builds a tmail object used to email the recipients of a project of the specified wiki content was updated.
204
205 # Builds a tmail object used to email the recipients of a project of the specified wiki content was updated.
206 206 #
207 207 # Example:
208 208 # wiki_content_updated(wiki_content) => tmail object
@@ -296,7 +296,7 class Mailer < ActionMailer::Base
296 296 return false if (recipients.nil? || recipients.empty?) &&
297 297 (cc.nil? || cc.empty?) &&
298 298 (bcc.nil? || bcc.empty?)
299
299
300 300 # Set Message-Id and References
301 301 if @message_id_object
302 302 mail.message_id = self.class.message_id_for(@message_id_object)
@@ -304,7 +304,7 class Mailer < ActionMailer::Base
304 304 if @references_objects
305 305 mail.references = @references_objects.collect {|o| self.class.message_id_for(o)}
306 306 end
307
307
308 308 # Log errors when raise_delivery_errors is set to false, Rails does not
309 309 raise_errors = self.class.raise_delivery_errors
310 310 self.class.raise_delivery_errors = true
@@ -347,7 +347,7 class Mailer < ActionMailer::Base
347 347 deliver_reminder(assignee, issues, days) if assignee && assignee.active?
348 348 end
349 349 end
350
350
351 351 # Activates/desactivates email deliveries during +block+
352 352 def self.with_deliveries(enabled = true, &block)
353 353 was_enabled = ActionMailer::Base.perform_deliveries
@@ -363,7 +363,7 class Mailer < ActionMailer::Base
363 363 @initial_language = current_language
364 364 set_language_if_valid Setting.default_language
365 365 from Setting.mail_from
366
366
367 367 # Common headers
368 368 headers 'X-Mailer' => 'Redmine',
369 369 'X-Redmine-Host' => Setting.host_name,
@@ -386,11 +386,11 class Mailer < ActionMailer::Base
386 386 recipients.delete(@author.mail) if recipients
387 387 cc.delete(@author.mail) if cc
388 388 end
389
389
390 390 notified_users = [recipients, cc].flatten.compact.uniq
391 391 # Rails would log recipients only, not cc and bcc
392 392 mylogger.info "Sending email notification to: #{notified_users.join(', ')}" if mylogger
393
393
394 394 # Blind carbon copy recipients
395 395 if Setting.bcc_recipients?
396 396 bcc(notified_users)
@@ -406,7 +406,7 class Mailer < ActionMailer::Base
406 406 #
407 407 # https://rails.lighthouseapp.com/projects/8994/tickets/2338-actionmailer-mailer-views-and-content-type
408 408 # https://rails.lighthouseapp.com/projects/8994/tickets/1799-actionmailer-doesnt-set-template_format-when-rendering-layouts
409
409
410 410 def render_multipart(method_name, body)
411 411 if Setting.plain_text_mail?
412 412 content_type "text/plain"
@@ -422,29 +422,29 class Mailer < ActionMailer::Base
422 422 def self.controller_path
423 423 ''
424 424 end unless respond_to?('controller_path')
425
425
426 426 # Returns a predictable Message-Id for the given object
427 427 def self.message_id_for(object)
428 428 # id + timestamp should reduce the odds of a collision
429 429 # as far as we don't send multiple emails for the same object
430 timestamp = object.send(object.respond_to?(:created_on) ? :created_on : :updated_on)
430 timestamp = object.send(object.respond_to?(:created_on) ? :created_on : :updated_on)
431 431 hash = "redmine.#{object.class.name.demodulize.underscore}-#{object.id}.#{timestamp.strftime("%Y%m%d%H%M%S")}"
432 432 host = Setting.mail_from.to_s.gsub(%r{^.*@}, '')
433 433 host = "#{::Socket.gethostname}.redmine" if host.empty?
434 434 "<#{hash}@#{host}>"
435 435 end
436
436
437 437 private
438
438
439 439 def message_id(object)
440 440 @message_id_object = object
441 441 end
442
442
443 443 def references(object)
444 444 @references_objects ||= []
445 445 @references_objects << object
446 446 end
447
447
448 448 def mylogger
449 449 RAILS_DEFAULT_LOGGER
450 450 end
General Comments 0
You need to be logged in to leave comments. Login now