diff options
author | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2007-01-27 15:01:19 +0000 |
---|---|---|
committer | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2007-01-27 15:01:19 +0000 |
commit | 2d47a6d71c0973598bf2d59c59bd4050e77f3861 (patch) | |
tree | d5e119cf6d5be90d667c90c4fc81cdd76ceb8543 /app/controllers/projects_controller.rb | |
parent | 22c2209cf9229e5f799a9612fadcb6119e412064 (diff) | |
download | redmine-2d47a6d71c0973598bf2d59c59bd4050e77f3861.tar.gz redmine-2d47a6d71c0973598bf2d59c59bd4050e77f3861.zip |
mail notifications added when:
* a document is added
* a file is added to the project
* an attachment is added to an issue or a document
git-svn-id: http://redmine.rubyforge.org/svn/trunk@196 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app/controllers/projects_controller.rb')
-rw-r--r-- | app/controllers/projects_controller.rb | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb index f536c39a2..e7db204ed 100644 --- a/app/controllers/projects_controller.rb +++ b/app/controllers/projects_controller.rb @@ -184,6 +184,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?
redirect_to :action => 'list_documents', :id => @project
end
end
@@ -385,9 +386,13 @@ class ProjectsController < ApplicationController if request.post?
@version = @project.versions.find_by_id(params[:version_id])
# Save the attachments
- params[:attachments].each { |a|
- Attachment.create(:container => @version, :file => a, :author => logged_in_user) unless a.size == 0
+ @attachments = []
+ params[:attachments].each { |file|
+ next unless file.size > 0
+ 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?
redirect_to :controller => 'projects', :action => 'list_files', :id => @project
end
@versions = @project.versions
|