From 59d2156b11d41d1579af9eac2388e7187a28c013 Mon Sep 17 00:00:00 2001 From: Rangga Permana Date: Tue, 24 Aug 2021 12:22:48 +1200 Subject: [PATCH 1/2] add per project email format --- lib/redmine_per_project_formatting.rb | 3 +++ lib/redmine_per_project_formatting/mailer.rb | 22 ++++++++++++++++++++ 2 files changed, 25 insertions(+) create mode 100644 lib/redmine_per_project_formatting/mailer.rb diff --git a/lib/redmine_per_project_formatting.rb b/lib/redmine_per_project_formatting.rb index e2dfdc8..2d9b46e 100644 --- a/lib/redmine_per_project_formatting.rb +++ b/lib/redmine_per_project_formatting.rb @@ -10,7 +10,10 @@ def self.apply_patch ::Setting.singleton_class.prepend SettingPatch if defined?(RedmineCkeditor) require 'redmine_per_project_formatting/mail_handler_patch' + require 'redmine_per_project_formatting/mailer_patch' ::MailHandler.prepend MailHandlerPatch + ::Mailer.prepend MailerPatch end end end + diff --git a/lib/redmine_per_project_formatting/mailer.rb b/lib/redmine_per_project_formatting/mailer.rb new file mode 100644 index 0000000..299ba6e --- /dev/null +++ b/lib/redmine_per_project_formatting/mailer.rb @@ -0,0 +1,22 @@ +module RedminePerProjectFormatting + module MailerPatch + def issue_add(user, issue) + if p = Issue.where(:id => issue.id).first.try(:project) + Setting.within_text_formatting(p.text_formatting_for(:issue_tracking)) do + super + end + end + end + + def issue_edit(user, journal) + issue = journal.journalized + if p = Issue.where(:id => issue.id).first.try(:project) + Setting.within_text_formatting(p.text_formatting_for(:issue_tracking)) do + super + end + end + end + + end +end + From 933864b5a25c0468c7f78839375bdb71d71c01b0 Mon Sep 17 00:00:00 2001 From: galupa Date: Wed, 25 Aug 2021 17:18:33 +1200 Subject: [PATCH 2/2] Rename mailer.rb to mailer_patch.rb --- lib/redmine_per_project_formatting/{mailer.rb => mailer_patch.rb} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename lib/redmine_per_project_formatting/{mailer.rb => mailer_patch.rb} (100%) diff --git a/lib/redmine_per_project_formatting/mailer.rb b/lib/redmine_per_project_formatting/mailer_patch.rb similarity index 100% rename from lib/redmine_per_project_formatting/mailer.rb rename to lib/redmine_per_project_formatting/mailer_patch.rb