Empty array of notifications recipients
This commit is contained in:
parent
2914eef375
commit
5e058f5aef
@ -634,8 +634,10 @@ class DmsfController < ApplicationController
|
||||
if Setting.plugin_redmine_dmsf['dmsf_display_notified_recipients'] && recipients.any?
|
||||
max_receivers = Setting.plugin_redmine_dmsf['dmsf_max_notification_receivers_info'].to_i
|
||||
to = recipients.collect { |user, _| user.name }.first(max_receivers).join(', ')
|
||||
to << (recipients.count > max_receivers ? ',...' : '.')
|
||||
flash[:warning] = l(:warning_email_notifications, to: to) if to.present?
|
||||
if to.present?
|
||||
to << (recipients.count > max_receivers ? ',...' : '.')
|
||||
flash[:warning] = l(:warning_email_notifications, to: to)
|
||||
end
|
||||
end
|
||||
rescue StandardError => e
|
||||
Rails.logger.error { "Could not send email notifications: #{e.message}" }
|
||||
|
||||
@ -182,7 +182,9 @@ class DmsfFilesController < ApplicationController
|
||||
if Setting.plugin_redmine_dmsf['dmsf_display_notified_recipients'] && recipients.any?
|
||||
max_notifications = Setting.plugin_redmine_dmsf['dmsf_max_notification_receivers_info'].to_i
|
||||
to = recipients.collect { |user, _| user.name }.first(max_notifications).join(', ')
|
||||
to << (recipients.count > max_notifications ? ',...' : '.')
|
||||
if to.present?
|
||||
to << (recipients.count > max_notifications ? ',...' : '.')
|
||||
end
|
||||
end
|
||||
rescue StandardError => e
|
||||
Rails.logger.error "Could not send email notifications: #{e.message}"
|
||||
@ -223,8 +225,10 @@ class DmsfFilesController < ApplicationController
|
||||
if Setting.plugin_redmine_dmsf['dmsf_display_notified_recipients'] && recipients.any?
|
||||
max_notification = Setting.plugin_redmine_dmsf['dmsf_max_notification_receivers_info'].to_i
|
||||
to = recipients.collect { |user, _| user.name }.first(max_notification).join(', ')
|
||||
to << (recipients.count > max_notification ? ',...' : '.')
|
||||
flash[:warning] = l(:warning_email_notifications, to: to) if to.present?
|
||||
if to.present?
|
||||
to << (recipients.count > max_notification ? ',...' : '.')
|
||||
flash[:warning] = l(:warning_email_notifications, to: to)
|
||||
end
|
||||
end
|
||||
rescue StandardError => e
|
||||
Rails.logger.error "Could not send email notifications: #{e.message}"
|
||||
|
||||
@ -101,8 +101,10 @@ class DmsfWorkflowsController < ApplicationController
|
||||
if Setting.plugin_redmine_dmsf['dmsf_display_notified_recipients'] && recipients.present?
|
||||
max_notifications = Setting.plugin_redmine_dmsf['dmsf_max_notification_receivers_info'].to_i
|
||||
to = recipients.collect(&:name).first(max_notifications).join(', ')
|
||||
to << (recipients.count > max_notifications ? ',...' : '.')
|
||||
flash[:warning] = l(:warning_email_notifications, to: to) if to.present?
|
||||
if to.present?
|
||||
to << (recipients.count > max_notifications ? ',...' : '.')
|
||||
flash[:warning] = l(:warning_email_notifications, to: to)
|
||||
end
|
||||
end
|
||||
end
|
||||
elsif Setting.notified_events.include?('dmsf_workflow_plural') # Just rejected
|
||||
@ -122,8 +124,10 @@ class DmsfWorkflowsController < ApplicationController
|
||||
if Setting.plugin_redmine_dmsf['dmsf_display_notified_recipients'] && recipients.present?
|
||||
max_notifications = Setting.plugin_redmine_dmsf['dmsf_max_notification_receivers_info'].to_i
|
||||
to = recipients.collect(&:name).first(max_notifications).join(', ')
|
||||
to << (recipients.count > max_notifications ? ',...' : '.')
|
||||
flash[:warning] = l(:warning_email_notifications, to: to) if to.present?
|
||||
if to.present?
|
||||
to << (recipients.count > max_notifications ? ',...' : '.')
|
||||
flash[:warning] = l(:warning_email_notifications, to: to)
|
||||
end
|
||||
end
|
||||
end
|
||||
elsif action.action == DmsfWorkflowStepAction::ACTION_DELEGATE
|
||||
@ -189,8 +193,10 @@ class DmsfWorkflowsController < ApplicationController
|
||||
unless recipients.empty?
|
||||
max_notifications = Setting.plugin_redmine_dmsf['dmsf_max_notification_receivers_info'].to_i
|
||||
to = recipients.collect(&:name).first(max_notifications).join(', ')
|
||||
to << (recipients.count > max_notifications ? ',...' : '.')
|
||||
flash[:warning] = l(:warning_email_notifications, to: to) if to.present?
|
||||
if to.present?
|
||||
to << (recipients.count > max_notifications ? ',...' : '.')
|
||||
flash[:warning] = l(:warning_email_notifications, to: to)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@ -141,8 +141,10 @@ module DmsfUploadHelper
|
||||
if Setting.plugin_redmine_dmsf['dmsf_display_notified_recipients'] && recipients.any?
|
||||
max_recipients = Setting.plugin_redmine_dmsf['dmsf_max_notification_receivers_info'].to_i
|
||||
to = recipients.collect { |user, _| user.name }.first(max_recipients).join(', ')
|
||||
to << (recipients.count > max_recipients ? ',...' : '.')
|
||||
controller.flash[:warning] = l(:warning_email_notifications, to: to) if controller && to.present?
|
||||
if to.present?
|
||||
to << (recipients.count > max_recipients ? ',...' : '.')
|
||||
controller.flash[:warning] = l(:warning_email_notifications, to: to) if controller
|
||||
end
|
||||
end
|
||||
rescue StandardError => e
|
||||
Rails.logger.error { "Could not send email notifications: #{e.message}" }
|
||||
|
||||
@ -253,7 +253,9 @@ class DmsfWorkflow < ApplicationRecord
|
||||
|
||||
max_recipients = Setting.plugin_redmine_dmsf['dmsf_max_notification_receivers_info'].to_i
|
||||
to = recipients.collect(&:name).first(max_recipients).join(', ')
|
||||
return if to.blank?
|
||||
|
||||
to << (recipients.count > max_recipients.to_i ? ',...' : '.')
|
||||
controller.flash[:warning] = l(:warning_email_notifications, to: to) if controller && to.present?
|
||||
controller.flash[:warning] = l(:warning_email_notifications, to: to) if controller
|
||||
end
|
||||
end
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user