diff options
author | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2007-09-14 15:30:46 +0000 |
---|---|---|
committer | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2007-09-14 15:30:46 +0000 |
commit | 23264ec3eb8e17543922a0093ed402a9d7ba5de9 (patch) | |
tree | 94817aaa5e78fe305732196d5c4ed79602a2ea78 /app/controllers | |
parent | 1fa1f620183d2268e906deadb1c5f87a0335d518 (diff) | |
download | redmine-23264ec3eb8e17543922a0093ed402a9d7ba5de9.tar.gz redmine-23264ec3eb8e17543922a0093ed402a9d7ba5de9.zip |
Mail notification options restored (default is: issue_added and issue_updated).
Added mail notification when adding a news (disabled by default).
git-svn-id: http://redmine.rubyforge.org/svn/trunk@728 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app/controllers')
-rw-r--r-- | app/controllers/admin_controller.rb | 6 | ||||
-rw-r--r-- | app/controllers/documents_controller.rb | 2 | ||||
-rw-r--r-- | app/controllers/issues_controller.rb | 4 | ||||
-rw-r--r-- | app/controllers/projects_controller.rb | 7 |
4 files changed, 13 insertions, 6 deletions
diff --git a/app/controllers/admin_controller.rb b/app/controllers/admin_controller.rb index 43dbb9964..2451f5ef6 100644 --- a/app/controllers/admin_controller.rb +++ b/app/controllers/admin_controller.rb @@ -46,6 +46,12 @@ class AdminController < ApplicationController end def mail_options + @notifiables = %w(issue_added issue_updated news_added document_added file_added message_posted) + if request.post? + Setting.notified_events = (params[:notified_events] || []) + flash[:notice] = l(:notice_successful_update) + redirect_to :controller => 'admin', :action => 'mail_options' + end end def test_email diff --git a/app/controllers/documents_controller.rb b/app/controllers/documents_controller.rb index 5659e9ced..b1b7deb64 100644 --- a/app/controllers/documents_controller.rb +++ b/app/controllers/documents_controller.rb @@ -52,7 +52,7 @@ class DocumentsController < ApplicationController a = Attachment.create(:container => @document, :file => file, :author => logged_in_user) @attachments << a unless a.new_record? } if params[:attachments] and params[:attachments].is_a? Array - Mailer.deliver_attachments_add(@attachments) if !@attachments.empty? #and Permission.find_by_controller_and_action(params[:controller], params[:action]).mail_enabled? + Mailer.deliver_attachments_add(@attachments) if !@attachments.empty? && Setting.notified_events.include?('document_added') redirect_to :action => 'show', :id => @document end diff --git a/app/controllers/issues_controller.rb b/app/controllers/issues_controller.rb index 4bd359c89..eadd2ad71 100644 --- a/app/controllers/issues_controller.rb +++ b/app/controllers/issues_controller.rb @@ -103,7 +103,7 @@ class IssuesController < ApplicationController :value => a.filename) unless a.new_record? } if params[:attachments] and params[:attachments].is_a? Array flash[:notice] = l(:notice_successful_update) - Mailer.deliver_issue_edit(journal) #if Permission.find_by_controller_and_action(params[:controller], params[:action]).mail_enabled? + Mailer.deliver_issue_edit(journal) if Setting.notified_events.include?('issue_updated') redirect_to :action => 'show', :id => @issue return end @@ -137,7 +137,7 @@ class IssuesController < ApplicationController end flash[:notice] = l(:notice_successful_update) - Mailer.deliver_issue_edit(journal) #if Permission.find_by_controller_and_action(params[:controller], params[:action]).mail_enabled? + Mailer.deliver_issue_edit(journal) if Setting.notified_events.include?('issue_updated') redirect_to :action => 'show', :id => @issue end rescue ActiveRecord::StaleObjectError diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb index 148d54d48..22d514f4d 100644 --- a/app/controllers/projects_controller.rb +++ b/app/controllers/projects_controller.rb @@ -187,7 +187,7 @@ class ProjectsController < ApplicationController Attachment.create(:container => @document, :file => a, :author => logged_in_user) unless a.size == 0 } if params[:attachments] and params[:attachments].is_a? Array flash[:notice] = l(:notice_successful_create) - Mailer.deliver_document_add(@document) #if Permission.find_by_controller_and_action(params[:controller], params[:action]).mail_enabled? + Mailer.deliver_document_add(@document) if Setting.notified_events.include?('document_added') redirect_to :action => 'list_documents', :id => @project end end @@ -231,7 +231,7 @@ class ProjectsController < ApplicationController if @issue.save @attachments.each(&:save) flash[:notice] = l(:notice_successful_create) - Mailer.deliver_issue_add(@issue) #if Permission.find_by_controller_and_action(params[:controller], params[:action]).mail_enabled? + Mailer.deliver_issue_add(@issue) if Setting.notified_events.include?('issue_added') redirect_to :action => 'list_issues', :id => @project end end @@ -380,6 +380,7 @@ class ProjectsController < ApplicationController @news.author_id = self.logged_in_user.id if self.logged_in_user if @news.save flash[:notice] = l(:notice_successful_create) + Mailer.deliver_news_added(@news) if Setting.notified_events.include?('news_added') redirect_to :action => 'list_news', :id => @project end end @@ -405,7 +406,7 @@ class ProjectsController < ApplicationController a = Attachment.create(:container => @version, :file => file, :author => logged_in_user) @attachments << a unless a.new_record? } if params[:attachments] and params[:attachments].is_a? Array - Mailer.deliver_attachments_add(@attachments) if !@attachments.empty? #and Permission.find_by_controller_and_action(params[:controller], params[:action]).mail_enabled? + Mailer.deliver_attachments_add(@attachments) if !@attachments.empty? && Setting.notified_events.include?('file_added') redirect_to :controller => 'projects', :action => 'list_files', :id => @project end @versions = @project.versions.sort |