E-mail notifications recipients are not displayes

This commit is contained in:
Karel Pičman 2019-02-15 14:16:11 +01:00
parent 3addcab702
commit f0bf0a895d
5 changed files with 12 additions and 10 deletions

View File

@ -38,12 +38,12 @@ Features
* Document tagging * Document tagging
* Trash bin * Trash bin
* Documents attachable to issues * Documents attachable to issues
* Compatible with Redmine 3.4.x * Compatible with Redmine 4.0.x
Dependencies Dependencies
------------ ------------
* Redmine 3.4.0 or higher * Redmine 4.0.0 or higher
### Full-text search (optional) ### 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 1. In case of upgrade BACKUP YOUR DATABASE first
2. Put redmine_dmsf plugin directory into plugins. 2. Put redmine_dmsf plugin directory into plugins.
3. Install dependencies: `bundle install`. 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`. 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. 6. Restart the web server.
7. You should configure the plugin via Redmine interface: Administration -> Plugins -> DMSF -> Configure. 7. You should configure the plugin via Redmine interface: Administration -> Plugins -> DMSF -> Configure.

View File

@ -522,9 +522,9 @@ class DmsfController < ApplicationController
# Activities # Activities
unless deleted_files.empty? unless deleted_files.empty?
begin 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'] 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.collect{ |r| r.name }.first(DMSF_MAX_NOTIFICATION_RECEIVERS_INFO).join(', ')
to << ((recipients.count > DMSF_MAX_NOTIFICATION_RECEIVERS_INFO) ? ',...' : '.') to << ((recipients.count > DMSF_MAX_NOTIFICATION_RECEIVERS_INFO) ? ',...' : '.')
flash[:warning] = l(:warning_email_notifications, :to => to) flash[:warning] = l(:warning_email_notifications, :to => to)

View File

@ -173,9 +173,9 @@ class DmsfFilesController < ApplicationController
@file.set_last_revision revision @file.set_last_revision revision
flash[:notice] = (flash[:notice].nil? ? '' : flash[:notice]) + l(:notice_file_revision_created) flash[:notice] = (flash[:notice].nil? ? '' : flash[:notice]) + l(:notice_file_revision_created)
begin begin
DmsfMailer.deliver_files_updated(@project, [@file]) recipients = DmsfMailer.deliver_files_updated(@project, [@file])
if Setting.plugin_redmine_dmsf['dmsf_display_notified_recipients'] 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.collect{ |r| r.name }.first(DMSF_MAX_NOTIFICATION_RECEIVERS_INFO).join(', ')
to << ((recipients.count > DMSF_MAX_NOTIFICATION_RECEIVERS_INFO) ? ',...' : '.') to << ((recipients.count > DMSF_MAX_NOTIFICATION_RECEIVERS_INFO) ? ',...' : '.')
flash[:warning] = l(:warning_email_notifications, :to => to) flash[:warning] = l(:warning_email_notifications, :to => to)
@ -203,9 +203,9 @@ class DmsfFilesController < ApplicationController
flash[:notice] = l(:notice_file_deleted) flash[:notice] = l(:notice_file_deleted)
unless commit unless commit
begin begin
DmsfMailer.deliver_files_deleted(@project, [@file]) recipients = DmsfMailer.deliver_files_deleted(@project, [@file])
if Setting.plugin_redmine_dmsf['dmsf_display_notified_recipients'] 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.collect{ |r| r.name }.first(DMSF_MAX_NOTIFICATION_RECEIVERS_INFO).join(', ')
to << ((recipients.count > DMSF_MAX_NOTIFICATION_RECEIVERS_INFO) ? ',...' : '.') to << ((recipients.count > DMSF_MAX_NOTIFICATION_RECEIVERS_INFO) ? ',...' : '.')
flash[:warning] = l(:warning_email_notifications, :to => to) flash[:warning] = l(:warning_email_notifications, :to => to)

View File

@ -142,7 +142,7 @@ module DmsfUploadHelper
# Notifications # Notifications
if (folder && folder.notification?) || (!folder && project.dmsf_notification?) if (folder && folder.notification?) || (!folder && project.dmsf_notification?)
begin begin
DmsfMailer.deliver_files_updated(project, files) recipients = DmsfMailer.deliver_files_updated(project, files)
if Setting.plugin_redmine_dmsf['dmsf_display_notified_recipients'] if Setting.plugin_redmine_dmsf['dmsf_display_notified_recipients']
unless recipients.empty? unless recipients.empty?
to = recipients.collect{ |r| r.name }.first(DMSF_MAX_NOTIFICATION_RECEIVERS_INFO).join(', ') to = recipients.collect{ |r| r.name }.first(DMSF_MAX_NOTIFICATION_RECEIVERS_INFO).join(', ')

View File

@ -30,6 +30,7 @@ class DmsfMailer < Mailer
users.each do |user| users.each do |user|
files_updated(user, project, files).deliver_later files_updated(user, project, files).deliver_later
end end
users
end end
def files_updated(user, project, files) def files_updated(user, project, files)
@ -49,6 +50,7 @@ class DmsfMailer < Mailer
users.each do |user| users.each do |user|
files_deleted(user, project, files).deliver_later files_deleted(user, project, files).deliver_later
end end
users
end end
def files_deleted(user, project, files) def files_deleted(user, project, files)