From e40966955fb1b8fadd4069fc84c2b3d7d408d850 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Karel=20Pi=C4=8Dman?= Date: Tue, 14 Mar 2023 10:27:55 +0100 Subject: [PATCH] undefined method 'name' for # --- app/controllers/dmsf_controller.rb | 2 +- app/controllers/dmsf_files_controller.rb | 12 ++++++++---- app/helpers/dmsf_upload_helper.rb | 6 ++++-- 3 files changed, 13 insertions(+), 7 deletions(-) diff --git a/app/controllers/dmsf_controller.rb b/app/controllers/dmsf_controller.rb index e2c7be7e..e6b91ba5 100644 --- a/app/controllers/dmsf_controller.rb +++ b/app/controllers/dmsf_controller.rb @@ -663,7 +663,7 @@ class DmsfController < ApplicationController recipients = DmsfMailer.deliver_files_deleted(@project, deleted_files) if Setting.plugin_redmine_dmsf['dmsf_display_notified_recipients'] if recipients.any? - to = recipients.collect{ |r| r.name }.first(Setting.plugin_redmine_dmsf['dmsf_max_notification_receivers_info'].to_i).join(', ') + to = recipients.collect{ |user, _| user.name }.first(Setting.plugin_redmine_dmsf['dmsf_max_notification_receivers_info'].to_i).join(', ') to << ((recipients.count > Setting.plugin_redmine_dmsf['dmsf_max_notification_receivers_info'].to_i) ? ',...' : '.') flash[:warning] = l(:warning_email_notifications, to: to) end diff --git a/app/controllers/dmsf_files_controller.rb b/app/controllers/dmsf_files_controller.rb index cc137fe4..a1ace9e3 100644 --- a/app/controllers/dmsf_files_controller.rb +++ b/app/controllers/dmsf_files_controller.rb @@ -184,8 +184,10 @@ class DmsfFilesController < ApplicationController recipients = DmsfMailer.deliver_files_updated(@project, [@file]) if Setting.plugin_redmine_dmsf['dmsf_display_notified_recipients'] if recipients.any? - to = recipients.collect{ |r| r.name }.first(Setting.plugin_redmine_dmsf['dmsf_max_notification_receivers_info'].to_i).join(', ') - to << ((recipients.count > Setting.plugin_redmine_dmsf['dmsf_max_notification_receivers_info'].to_i) ? ',...' : '.') + to = recipients.collect{ |user, _| user.name }.first( + Setting.plugin_redmine_dmsf['dmsf_max_notification_receivers_info'].to_i).join(', ') + to << ((recipients.count > Setting.plugin_redmine_dmsf['dmsf_max_notification_receivers_info'].to_i) ? + ',...' : '.') end end rescue => e @@ -229,8 +231,10 @@ class DmsfFilesController < ApplicationController recipients = DmsfMailer.deliver_files_deleted(@project, [@file]) if Setting.plugin_redmine_dmsf['dmsf_display_notified_recipients'] if recipients.any? - to = recipients.collect{ |r| r.name }.first(Setting.plugin_redmine_dmsf['dmsf_max_notification_receivers_info'].to_i).join(', ') - to << ((recipients.count > Setting.plugin_redmine_dmsf['dmsf_max_notification_receivers_info'].to_i) ? ',...' : '.') + to = recipients.collect{ |user, _| user.name }.first( + Setting.plugin_redmine_dmsf['dmsf_max_notification_receivers_info'].to_i).join(', ') + to << ((recipients.count > Setting.plugin_redmine_dmsf['dmsf_max_notification_receivers_info'].to_i) ? + ',...' : '.') flash[:warning] = l(:warning_email_notifications, to: to) end end diff --git a/app/helpers/dmsf_upload_helper.rb b/app/helpers/dmsf_upload_helper.rb index 0050107b..b7383fcc 100644 --- a/app/helpers/dmsf_upload_helper.rb +++ b/app/helpers/dmsf_upload_helper.rb @@ -133,8 +133,10 @@ module DmsfUploadHelper recipients = DmsfMailer.deliver_files_updated(project, files) if Setting.plugin_redmine_dmsf['dmsf_display_notified_recipients'] unless recipients.empty? - to = recipients.collect{ |r| r.name }.first(Setting.plugin_redmine_dmsf['dmsf_max_notification_receivers_info'].to_i).join(', ') - to << ((recipients.count > Setting.plugin_redmine_dmsf['dmsf_max_notification_receivers_info'].to_i) ? ',...' : '.') + to = recipients.collect{ |user, _| user.name }.first( + Setting.plugin_redmine_dmsf['dmsf_max_notification_receivers_info'].to_i).join(', ') + to << ((recipients.count > Setting.plugin_redmine_dmsf['dmsf_max_notification_receivers_info'].to_i) ? + ',...' : '.') controller.flash[:warning] = l(:warning_email_notifications, to: to) if controller end end