diff --git a/app/controllers/dmsf_upload_controller.rb b/app/controllers/dmsf_upload_controller.rb index 741a95bf..cd3d845b 100644 --- a/app/controllers/dmsf_upload_controller.rb +++ b/app/controllers/dmsf_upload_controller.rb @@ -177,20 +177,22 @@ class DmsfUploadController < ApplicationController end unless files.empty? files.each { |file| log_activity(file, 'uploaded') if file } - begin - recipients = DmsfMailer.get_notify_users(@project, files) - recipients.each do |u| - DmsfMailer.files_updated(u, @project, files).deliver - end - if Setting.plugin_redmine_dmsf[:dmsf_display_notified_recipients] == '1' - unless recipients.empty? - to = recipients.collect{ |r| r.name }.first(DMSF_MAX_NOTIFICATION_RECEIVERS_INFO).join(', ') - to << ((recipients.count > DMSF_MAX_NOTIFICATION_RECEIVERS_INFO) ? ',...' : '.') - flash[:warning] = l(:warning_email_notifications, :to => to) + if (@folder && @folder.notification?) || (!@folder && @project.dmsf_notification?) + begin + recipients = DmsfMailer.get_notify_users(@project, files) + recipients.each do |u| + DmsfMailer.files_updated(u, @project, files).deliver + end + if Setting.plugin_redmine_dmsf[:dmsf_display_notified_recipients] == '1' + unless recipients.empty? + to = recipients.collect{ |r| r.name }.first(DMSF_MAX_NOTIFICATION_RECEIVERS_INFO).join(', ') + to << ((recipients.count > DMSF_MAX_NOTIFICATION_RECEIVERS_INFO) ? ',...' : '.') + flash[:warning] = l(:warning_email_notifications, :to => to) + end end + rescue Exception => e + Rails.logger.error "Could not send email notifications: #{e.message}" end - rescue Exception => e - Rails.logger.error "Could not send email notifications: #{e.message}" end end unless failed_uploads.empty?