Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added support for redmine 4 #5

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 11 additions & 13 deletions lib/mailer_patch.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ def self.included(base) # :nodoc:
base.send(:include, InstanceMethods)

base.class_eval do
alias_method_chain :mail, :project_sender
alias_method :mail_without_project_sender, :mail
alias_method :mail, :mail_with_project_sender
end

end
Expand All @@ -19,7 +20,7 @@ def mail_with_project_sender(headers={}, &block)
'X-Auto-Response-Suppress' => 'All',
'Auto-Submitted' => 'auto-generated',
'From' => mail_from_project_sender,
'List-Id' => "<#{Setting.mail_from.to_s.gsub('@', '.')}>"
'List-Id' => "<#{mail_from_project_sender.to_s.tr('@', '.')}>"

# Replaces users with their email addresses
[:to, :cc, :bcc].each do |key|
Expand Down Expand Up @@ -55,17 +56,14 @@ def mail_with_project_sender(headers={}, &block)
headers[:references] = @references_objects.collect {|o| "<#{self.class.references_for(o)}>"}.join(' ')
end

m = if block_given?
super headers, &block
else
super headers do |format|
format.text
format.html unless Setting.plain_text_mail?
end
end
set_language_if_valid @initial_language

m
if block_given?
super headers, &block
else
super headers do |format|
format.text
format.html unless Setting.plain_text_mail?
end
end
end

private
Expand Down