From e0fc848696603cfe70040112b3e297c55eea2775 Mon Sep 17 00:00:00 2001 From: Jean-Philippe Lang Date: Sun, 10 May 2015 07:22:59 +0000 Subject: Merged r14243 (#19793). git-svn-id: http://svn.redmine.org/redmine/branches/3.0-stable@14251 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- app/controllers/files_controller.rb | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'app') diff --git a/app/controllers/files_controller.rb b/app/controllers/files_controller.rb index 253d73bfa..73409c765 100644 --- a/app/controllers/files_controller.rb +++ b/app/controllers/files_controller.rb @@ -47,9 +47,16 @@ class FilesController < ApplicationController attachments = Attachment.attach_files(container, params[:attachments]) render_attachment_warning_if_needed(container) - if !attachments.empty? && !attachments[:files].blank? && Setting.notified_events.include?('file_added') - Mailer.attachments_added(attachments[:files]).deliver + if attachments[:files].present? + if Setting.notified_events.include?('file_added') + Mailer.attachments_added(attachments[:files]).deliver + end + flash[:notice] = l(:label_file_added) + redirect_to project_files_path(@project) + else + flash.now[:error] = l(:label_attachment) + " " + l('activerecord.errors.messages.invalid') + new + render :action => 'new' end - redirect_to project_files_path(@project) end end -- cgit v1.2.3