Unwanted notifications #340

This commit is contained in:
Karel Pičman 2015-01-28 13:30:13 +01:00
parent 61777425d3
commit 9bd4890c32

View File

@ -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?