From f0bf0a895d2904c0afc756d87fb244b944ceb9b0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Karel=20Pi=C4=8Dman?= Date: Fri, 15 Feb 2019 14:16:11 +0100 Subject: [PATCH] E-mail notifications recipients are not displayes --- README.md | 6 +++--- app/controllers/dmsf_controller.rb | 4 ++-- app/controllers/dmsf_files_controller.rb | 8 ++++---- app/helpers/dmsf_upload_helper.rb | 2 +- app/models/dmsf_mailer.rb | 2 ++ 5 files changed, 12 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index 6bd7ae25..05b6c8ee 100644 --- a/README.md +++ b/README.md @@ -38,12 +38,12 @@ Features * Document tagging * Trash bin * Documents attachable to issues - * Compatible with Redmine 3.4.x + * Compatible with Redmine 4.0.x Dependencies ------------ - * Redmine 3.4.0 or higher + * Redmine 4.0.0 or higher ### Full-text search (optional) @@ -216,7 +216,7 @@ Before installing ensure that the Redmine instance is stopped. 1. In case of upgrade BACKUP YOUR DATABASE first 2. Put redmine_dmsf plugin directory into plugins. 3. Install dependencies: `bundle install`. -4. Initialize/Update database: `bundle exec rake redmine:plugins:migrate RAILS_ENV="production"`. +4. Initialize/Update database: `bundle exec rake redmine:plugins:migrate NAME=redmine_dmsf RAILS_ENV="production"`. 5. The access rights must be set for web server, example: `chown -R www-data:www-data plugins/redmine_dmsf`. 6. Restart the web server. 7. You should configure the plugin via Redmine interface: Administration -> Plugins -> DMSF -> Configure. diff --git a/app/controllers/dmsf_controller.rb b/app/controllers/dmsf_controller.rb index b5b61056..73b0f269 100644 --- a/app/controllers/dmsf_controller.rb +++ b/app/controllers/dmsf_controller.rb @@ -522,9 +522,9 @@ class DmsfController < ApplicationController # Activities unless deleted_files.empty? begin - DmsfMailer.deliver_files_deleted(@project, deleted_files) + recipients = DmsfMailer.deliver_files_deleted(@project, deleted_files) if Setting.plugin_redmine_dmsf['dmsf_display_notified_recipients'] - unless recipients.empty? + if recipients.any? 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) diff --git a/app/controllers/dmsf_files_controller.rb b/app/controllers/dmsf_files_controller.rb index da8f4ead..c95e9f1a 100644 --- a/app/controllers/dmsf_files_controller.rb +++ b/app/controllers/dmsf_files_controller.rb @@ -173,9 +173,9 @@ class DmsfFilesController < ApplicationController @file.set_last_revision revision flash[:notice] = (flash[:notice].nil? ? '' : flash[:notice]) + l(:notice_file_revision_created) begin - DmsfMailer.deliver_files_updated(@project, [@file]) + recipients = DmsfMailer.deliver_files_updated(@project, [@file]) if Setting.plugin_redmine_dmsf['dmsf_display_notified_recipients'] - unless recipients.empty? + if recipients.any? 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) @@ -203,9 +203,9 @@ class DmsfFilesController < ApplicationController flash[:notice] = l(:notice_file_deleted) unless commit begin - DmsfMailer.deliver_files_deleted(@project, [@file]) + recipients = DmsfMailer.deliver_files_deleted(@project, [@file]) if Setting.plugin_redmine_dmsf['dmsf_display_notified_recipients'] - unless recipients.empty? + if recipients.any? 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) diff --git a/app/helpers/dmsf_upload_helper.rb b/app/helpers/dmsf_upload_helper.rb index b6ed1803..2ee242e6 100644 --- a/app/helpers/dmsf_upload_helper.rb +++ b/app/helpers/dmsf_upload_helper.rb @@ -142,7 +142,7 @@ module DmsfUploadHelper # Notifications if (folder && folder.notification?) || (!folder && project.dmsf_notification?) begin - DmsfMailer.deliver_files_updated(project, files) + 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(DMSF_MAX_NOTIFICATION_RECEIVERS_INFO).join(', ') diff --git a/app/models/dmsf_mailer.rb b/app/models/dmsf_mailer.rb index cfef7887..cf2cda02 100644 --- a/app/models/dmsf_mailer.rb +++ b/app/models/dmsf_mailer.rb @@ -30,6 +30,7 @@ class DmsfMailer < Mailer users.each do |user| files_updated(user, project, files).deliver_later end + users end def files_updated(user, project, files) @@ -49,6 +50,7 @@ class DmsfMailer < Mailer users.each do |user| files_deleted(user, project, files).deliver_later end + users end def files_deleted(user, project, files)