summaryrefslogtreecommitdiffstats
path: root/app/models
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2010-03-21 11:17:29 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2010-03-21 11:17:29 +0000
commit79b4f681760e9d674e5b959abcb3087fee009008 (patch)
tree8d97b3c0a653e8f58bf7febb93e0d4e405043fed /app/models
parent5225fb70f533c992bd50435096ebd2bfb1c3e942 (diff)
downloadredmine-79b4f681760e9d674e5b959abcb3087fee009008.tar.gz
redmine-79b4f681760e9d674e5b959abcb3087fee009008.zip
Adds an option to enable/disable email notifications during a project copy (#4672).
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@3608 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app/models')
-rw-r--r--app/models/mailer.rb9
1 files changed, 9 insertions, 0 deletions
diff --git a/app/models/mailer.rb b/app/models/mailer.rb
index 173e33c40..f39c53209 100644
--- a/app/models/mailer.rb
+++ b/app/models/mailer.rb
@@ -324,6 +324,15 @@ class Mailer < ActionMailer::Base
deliver_reminder(assignee, issues, days) unless assignee.nil?
end
end
+
+ # Activates/desactivates email deliveries during +block+
+ def self.with_deliveries(enabled = true, &block)
+ was_enabled = ActionMailer::Base.perform_deliveries
+ ActionMailer::Base.perform_deliveries = !!enabled
+ yield
+ ensure
+ ActionMailer::Base.perform_deliveries = was_enabled
+ end
private
def initialize_defaults(method_name)