remove trailing white-spaces from mailer model source.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@5816 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
parent
f2e5b62448
commit
01c5311662
|
@ -31,7 +31,7 @@ class Mailer < ActionMailer::Base
|
|||
h = h.to_s.gsub(%r{\/.*$}, '') unless Redmine::Utils.relative_url_root.blank?
|
||||
{ :host => h, :protocol => Setting.protocol }
|
||||
end
|
||||
|
||||
|
||||
# Builds a tmail object used to email recipients of the added issue.
|
||||
#
|
||||
# Example:
|
||||
|
@ -133,7 +133,7 @@ class Mailer < ActionMailer::Base
|
|||
:added_to_url => added_to_url
|
||||
render_multipart('attachments_added', body)
|
||||
end
|
||||
|
||||
|
||||
# Builds a tmail object used to email recipients of a news' project when a news item is added.
|
||||
#
|
||||
# Example:
|
||||
|
@ -148,7 +148,7 @@ class Mailer < ActionMailer::Base
|
|||
:news_url => url_for(:controller => 'news', :action => 'show', :id => news)
|
||||
render_multipart('news_added', body)
|
||||
end
|
||||
|
||||
|
||||
# Builds a tmail object used to email recipients of a news' project when a news comment is added.
|
||||
#
|
||||
# Example:
|
||||
|
@ -167,7 +167,7 @@ class Mailer < ActionMailer::Base
|
|||
render_multipart('news_comment_added', body)
|
||||
end
|
||||
|
||||
# Builds a tmail object used to email the recipients of the specified message that was posted.
|
||||
# Builds a tmail object used to email the recipients of the specified message that was posted.
|
||||
#
|
||||
# Example:
|
||||
# message_posted(message) => tmail object
|
||||
|
@ -184,8 +184,8 @@ class Mailer < ActionMailer::Base
|
|||
:message_url => url_for(message.event_url)
|
||||
render_multipart('message_posted', body)
|
||||
end
|
||||
|
||||
# Builds a tmail object used to email the recipients of a project of the specified wiki content was added.
|
||||
|
||||
# Builds a tmail object used to email the recipients of a project of the specified wiki content was added.
|
||||
#
|
||||
# Example:
|
||||
# wiki_content_added(wiki_content) => tmail object
|
||||
|
@ -201,8 +201,8 @@ class Mailer < ActionMailer::Base
|
|||
:wiki_content_url => url_for(:controller => 'wiki', :action => 'show', :project_id => wiki_content.project, :id => wiki_content.page.title)
|
||||
render_multipart('wiki_content_added', body)
|
||||
end
|
||||
|
||||
# Builds a tmail object used to email the recipients of a project of the specified wiki content was updated.
|
||||
|
||||
# Builds a tmail object used to email the recipients of a project of the specified wiki content was updated.
|
||||
#
|
||||
# Example:
|
||||
# wiki_content_updated(wiki_content) => tmail object
|
||||
|
@ -296,7 +296,7 @@ class Mailer < ActionMailer::Base
|
|||
return false if (recipients.nil? || recipients.empty?) &&
|
||||
(cc.nil? || cc.empty?) &&
|
||||
(bcc.nil? || bcc.empty?)
|
||||
|
||||
|
||||
# Set Message-Id and References
|
||||
if @message_id_object
|
||||
mail.message_id = self.class.message_id_for(@message_id_object)
|
||||
|
@ -304,7 +304,7 @@ class Mailer < ActionMailer::Base
|
|||
if @references_objects
|
||||
mail.references = @references_objects.collect {|o| self.class.message_id_for(o)}
|
||||
end
|
||||
|
||||
|
||||
# Log errors when raise_delivery_errors is set to false, Rails does not
|
||||
raise_errors = self.class.raise_delivery_errors
|
||||
self.class.raise_delivery_errors = true
|
||||
|
@ -347,7 +347,7 @@ class Mailer < ActionMailer::Base
|
|||
deliver_reminder(assignee, issues, days) if assignee && assignee.active?
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
# Activates/desactivates email deliveries during +block+
|
||||
def self.with_deliveries(enabled = true, &block)
|
||||
was_enabled = ActionMailer::Base.perform_deliveries
|
||||
|
@ -363,7 +363,7 @@ class Mailer < ActionMailer::Base
|
|||
@initial_language = current_language
|
||||
set_language_if_valid Setting.default_language
|
||||
from Setting.mail_from
|
||||
|
||||
|
||||
# Common headers
|
||||
headers 'X-Mailer' => 'Redmine',
|
||||
'X-Redmine-Host' => Setting.host_name,
|
||||
|
@ -386,11 +386,11 @@ class Mailer < ActionMailer::Base
|
|||
recipients.delete(@author.mail) if recipients
|
||||
cc.delete(@author.mail) if cc
|
||||
end
|
||||
|
||||
|
||||
notified_users = [recipients, cc].flatten.compact.uniq
|
||||
# Rails would log recipients only, not cc and bcc
|
||||
mylogger.info "Sending email notification to: #{notified_users.join(', ')}" if mylogger
|
||||
|
||||
|
||||
# Blind carbon copy recipients
|
||||
if Setting.bcc_recipients?
|
||||
bcc(notified_users)
|
||||
|
@ -406,7 +406,7 @@ class Mailer < ActionMailer::Base
|
|||
#
|
||||
# https://rails.lighthouseapp.com/projects/8994/tickets/2338-actionmailer-mailer-views-and-content-type
|
||||
# https://rails.lighthouseapp.com/projects/8994/tickets/1799-actionmailer-doesnt-set-template_format-when-rendering-layouts
|
||||
|
||||
|
||||
def render_multipart(method_name, body)
|
||||
if Setting.plain_text_mail?
|
||||
content_type "text/plain"
|
||||
|
@ -422,29 +422,29 @@ class Mailer < ActionMailer::Base
|
|||
def self.controller_path
|
||||
''
|
||||
end unless respond_to?('controller_path')
|
||||
|
||||
|
||||
# Returns a predictable Message-Id for the given object
|
||||
def self.message_id_for(object)
|
||||
# id + timestamp should reduce the odds of a collision
|
||||
# as far as we don't send multiple emails for the same object
|
||||
timestamp = object.send(object.respond_to?(:created_on) ? :created_on : :updated_on)
|
||||
timestamp = object.send(object.respond_to?(:created_on) ? :created_on : :updated_on)
|
||||
hash = "redmine.#{object.class.name.demodulize.underscore}-#{object.id}.#{timestamp.strftime("%Y%m%d%H%M%S")}"
|
||||
host = Setting.mail_from.to_s.gsub(%r{^.*@}, '')
|
||||
host = "#{::Socket.gethostname}.redmine" if host.empty?
|
||||
"<#{hash}@#{host}>"
|
||||
end
|
||||
|
||||
|
||||
private
|
||||
|
||||
|
||||
def message_id(object)
|
||||
@message_id_object = object
|
||||
end
|
||||
|
||||
|
||||
def references(object)
|
||||
@references_objects ||= []
|
||||
@references_objects << object
|
||||
end
|
||||
|
||||
|
||||
def mylogger
|
||||
RAILS_DEFAULT_LOGGER
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue