Email notification subject in Redmine format

This commit is contained in:
Karel Picman 2016-02-22 15:38:20 +01:00
parent c55fbe8dfa
commit fff94e1f3a
2 changed files with 23 additions and 11 deletions

View File

@ -590,9 +590,17 @@ class DmsfController < ApplicationController
log_activity(f, 'deleted')
end
begin
DmsfMailer.get_notify_users(@project, deleted_files).each do |u|
recipients = DmsfMailer.get_notify_users(@project, deleted_files)
recipients.each do |u|
DmsfMailer.files_deleted(u, @project, deleted_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

View File

@ -211,17 +211,23 @@ class DmsfFilesController < ApplicationController
if commit
log_activity('deleted')
begin
DmsfMailer.get_notify_users(@project, [@file]).each do |u|
recipients = DmsfMailer.get_notify_users(@project, [@file])
recipients.each do |u|
DmsfMailer.files_deleted(u, @project, [@file]).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
end
else
@file.errors.each do |e, msg|
flash[:error] = msg
end
else
flash[:error] = @file.errors.full_messages.join(', ')
end
end
if commit
@ -236,10 +242,8 @@ class DmsfFilesController < ApplicationController
if @revision.delete(true)
flash[:notice] = l(:notice_revision_deleted)
log_activity('deleted')
else
@revision.errors.each do |e, msg|
flash[:error] = msg
end
else
flash[:error] = @revision.errors.full_messages.join(', ')
end
end
redirect_to :action => 'show', :id => @file
@ -331,4 +335,4 @@ class DmsfFilesController < ApplicationController
end
end
end
end