mirror of
https://github.com/redmine/redmine.git
synced 2025-11-04 20:35:57 +01:00
Refactor: Decouple failed attachments and the flash messages
Attachment#attach_files will no longer need to return a flash message, instead it will put unsaved attachments into object#unsaved_attachments where the calling object can access them. A utility method #render_attachment_warning_if_needed is included for setting the standard flash warning. git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@3528 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
@@ -304,7 +304,7 @@ class ProjectsController < ApplicationController
|
||||
if request.post?
|
||||
container = (params[:version_id].blank? ? @project : @project.versions.find_by_id(params[:version_id]))
|
||||
attachments = Attachment.attach_files(container, params[:attachments])
|
||||
flash[:warning] = attachments[:flash] if attachments[:flash]
|
||||
render_attachment_warning_if_needed(container)
|
||||
|
||||
if !attachments.empty? && Setting.notified_events.include?('file_added')
|
||||
Mailer.deliver_attachments_added(attachments[:files])
|
||||
|
||||
Reference in New Issue
Block a user