patch mailer to fix mail threading (#6582)
This commit is contained in:
parent
a763ab6b96
commit
7b9889abe7
3
init.rb
3
init.rb
|
@ -2,9 +2,10 @@ require 'redmine'
|
|||
|
||||
require_dependency 'welcome_controller_patch'
|
||||
require_dependency 'project_model_patch'
|
||||
require_dependency 'mailer_patch'
|
||||
|
||||
Redmine::Plugin.register :redmine_entrouvert do
|
||||
name 'Redmine Entr\'ouvert plugin'
|
||||
author 'Entr\'ouvert'
|
||||
version '0.1.0'
|
||||
version '0.2.0'
|
||||
end
|
||||
|
|
|
@ -0,0 +1,23 @@
|
|||
module MailerPatch
|
||||
def self.included(base)
|
||||
base.class_eval do
|
||||
def self.token_for(object, rand=true)
|
||||
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")
|
||||
]
|
||||
# disabled, see https://dev.entrouvert.org/issues/6582
|
||||
#if rand
|
||||
# hash << Redmine::Utils.random_hex(8)
|
||||
#end
|
||||
host = Setting.mail_from.to_s.gsub(%r{^.*@}, '')
|
||||
host = "#{::Socket.gethostname}.redmine" if host.empty?
|
||||
"#{hash.join('.')}@#{host}"
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Mailer.send(:include, MailerPatch)
|
Reference in New Issue