diff --git a/app/controllers/dmsf_controller.rb b/app/controllers/dmsf_controller.rb index 87816e56..417f543c 100644 --- a/app/controllers/dmsf_controller.rb +++ b/app/controllers/dmsf_controller.rb @@ -590,9 +590,17 @@ class DmsfController < ApplicationController log_activity(f, 'deleted') end begin - DmsfMailer.get_notify_users(@project, deleted_files).each do |u| + recipients = DmsfMailer.get_notify_users(@project, deleted_files) + recipients.each do |u| DmsfMailer.files_deleted(u, @project, deleted_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 diff --git a/app/controllers/dmsf_files_controller.rb b/app/controllers/dmsf_files_controller.rb index abb54e86..7c20cd89 100644 --- a/app/controllers/dmsf_files_controller.rb +++ b/app/controllers/dmsf_files_controller.rb @@ -211,17 +211,23 @@ class DmsfFilesController < ApplicationController if commit log_activity('deleted') begin - DmsfMailer.get_notify_users(@project, [@file]).each do |u| + recipients = DmsfMailer.get_notify_users(@project, [@file]) + recipients.each do |u| DmsfMailer.files_deleted(u, @project, [@file]).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 end - else - @file.errors.each do |e, msg| - flash[:error] = msg - end + else + flash[:error] = @file.errors.full_messages.join(', ') end end if commit @@ -236,10 +242,8 @@ class DmsfFilesController < ApplicationController if @revision.delete(true) flash[:notice] = l(:notice_revision_deleted) log_activity('deleted') - else - @revision.errors.each do |e, msg| - flash[:error] = msg - end + else + flash[:error] = @revision.errors.full_messages.join(', ') end end redirect_to :action => 'show', :id => @file @@ -331,4 +335,4 @@ class DmsfFilesController < ApplicationController end end -end +end \ No newline at end of file