| 4 |
4 |
module ActiveRecord
|
| 5 |
5 |
class Base
|
| 6 |
6 |
include Redmine::I18n
|
| 7 |
|
|
|
7 |
|
| 8 |
8 |
# Translate attribute names for validation errors display
|
| 9 |
9 |
def self.human_attribute_name(attr)
|
| 10 |
10 |
l("field_#{attr.to_s.gsub(/_id$/, '')}", :default => attr)
|
| ... | ... | |
| 65 |
65 |
|
| 66 |
66 |
ActionView::Base.field_error_proc = Proc.new{ |html_tag, instance| "#{html_tag}" }
|
| 67 |
67 |
|
| 68 |
|
# Adds :async_smtp and :async_sendmail delivery methods
|
| 69 |
|
# to perform email deliveries asynchronously
|
| 70 |
68 |
module AsynchronousMailer
|
|
69 |
# Adds :async_smtp and :async_sendmail delivery methods
|
|
70 |
# to perform email deliveries asynchronously
|
| 71 |
71 |
%w(smtp sendmail).each do |type|
|
| 72 |
72 |
define_method("perform_delivery_async_#{type}") do |mail|
|
| 73 |
73 |
Thread.start do
|
| 74 |
74 |
send "perform_delivery_#{type}", mail
|
| 75 |
|
end
|
|
75 |
end
|
| 76 |
76 |
end
|
| 77 |
77 |
end
|
|
78 |
|
|
79 |
# Adds a delivery method that writes emails in tmp/emails for testing purpose
|
|
80 |
def perform_delivery_tmp_file(mail)
|
|
81 |
dest_dir = File.join(Rails.root, 'tmp', 'emails')
|
|
82 |
Dir.mkdir(dest_dir) unless File.directory?(dest_dir)
|
|
83 |
File.open(File.join(dest_dir, mail.message_id.gsub(/[<>]/, '') + '.eml'), 'wb') {|f| f.write(mail.encoded) }
|
|
84 |
end
|
| 78 |
85 |
end
|
| 79 |
86 |
|
| 80 |
87 |
ActionMailer::Base.send :include, AsynchronousMailer
|
| 81 |
88 |
|
| 82 |
|
# TMail::Unquoter.convert_to_with_fallback_on_iso_8859_1 introduced in TMail 1.2.7
|
| 83 |
|
# triggers a test failure in test_add_issue_with_japanese_keywords(MailHandlerTest)
|
| 84 |
89 |
module TMail
|
|
90 |
# TMail::Unquoter.convert_to_with_fallback_on_iso_8859_1 introduced in TMail 1.2.7
|
|
91 |
# triggers a test failure in test_add_issue_with_japanese_keywords(MailHandlerTest)
|
| 85 |
92 |
class Unquoter
|
| 86 |
93 |
class << self
|
| 87 |
94 |
alias_method :convert_to, :convert_to_without_fallback_on_iso_8859_1
|
| 88 |
95 |
end
|
| 89 |
96 |
end
|
|
97 |
|
|
98 |
# Patch for TMail 1.2.7. See http://www.redmine.org/issues/8751
|
|
99 |
class Encoder
|
|
100 |
def puts_meta(str)
|
|
101 |
add_text str
|
|
102 |
end
|
|
103 |
end
|
| 90 |
104 |
end
|
| 91 |
105 |
|
| 92 |
106 |
module ActionController
|