diff --git a/app/models/dmsf_mailer.rb b/app/models/dmsf_mailer.rb index 3a774b9e..0883b6c5 100644 --- a/app/models/dmsf_mailer.rb +++ b/app/models/dmsf_mailer.rb @@ -39,6 +39,7 @@ class DmsfMailer < Mailer @files = files @project = project @author = files.first.last_revision.user if files.first.last_revision + @author = User.anonymous unless @author message_id project set_language_if_valid user.language mail :to => user.mail, subject: "[#{@project.name} - #{l(:menu_dmsf)}] #{l(:text_email_doc_updated_subject)}" @@ -60,6 +61,7 @@ class DmsfMailer < Mailer @files = files @project = project @author = files.first.deleted_by_user + @author = User.anonymous unless @author message_id project set_language_if_valid user.language mail :to => user.mail, @@ -68,7 +70,7 @@ class DmsfMailer < Mailer end def self.deliver_send_documents(project, email_params, author) - send_documents(User.current, project, email_params).deliver_now + send_documents(User.current, project, email_params, author).deliver_now end def send_documents(_, project, email_params, author) @@ -109,6 +111,7 @@ class DmsfMailer < Mailer @text2 = l(text2_id) @notice = notice @author = User.find_by(id: revision.dmsf_workflow_assigned_by) + @author = User.anonymous unless @author mail :to => user.mail, :subject => "[#{@project.name} - #{l(:field_label_dmsf_workflow)}] #{@workflow.name} #{l(subject_id)}" end diff --git a/app/views/dmsf_mailer/files_deleted.html.erb b/app/views/dmsf_mailer/files_deleted.html.erb index e4956298..5fabf940 100644 --- a/app/views/dmsf_mailer/files_deleted.html.erb +++ b/app/views/dmsf_mailer/files_deleted.html.erb @@ -18,7 +18,7 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.%> -<%= link_to @author, user_url(@author) %> <%= l(:text_email_doc_deleted) if @author%> +<%= link_to @author, user_url(@author) %> <%= l(:text_email_doc_deleted) %> <%= link_to @project, project_url(@project) %> <%= l(:text_email_doc_follows) %> <% @files.each do |file| %>
diff --git a/app/views/dmsf_mailer/files_deleted.text.erb b/app/views/dmsf_mailer/files_deleted.text.erb index 159cb4e6..92cbd16f 100644 --- a/app/views/dmsf_mailer/files_deleted.text.erb +++ b/app/views/dmsf_mailer/files_deleted.text.erb @@ -21,7 +21,7 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.%> -<%= @author.name %> <%= l(:text_email_doc_deleted) %> <%= @project.name %> <%= l(:text_email_doc_follows) if @author %> +<%= @author.name %> <%= l(:text_email_doc_deleted) %> <%= @project.name %> <%= l(:text_email_doc_follows) %> <% @files.each do |file| %> <%= h(file.dmsf_path_str) %> (<%= file.name %>) <% if file.last_revision %> diff --git a/app/views/dmsf_mailer/files_updated.html.erb b/app/views/dmsf_mailer/files_updated.html.erb index d970a0d7..3af0256d 100644 --- a/app/views/dmsf_mailer/files_updated.html.erb +++ b/app/views/dmsf_mailer/files_updated.html.erb @@ -18,7 +18,7 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.%> -<%= link_to @author, user_url(@author) %> <%= l(:text_email_doc_updated) if @author%> +<%= link_to @author, user_url(@author) %> <%= l(:text_email_doc_updated) %> <%= link_to @project, project_url(@project) %> <%= l(:text_email_doc_follows) %> <% @files.each do |file| %>
diff --git a/app/views/dmsf_mailer/files_updated.text.erb b/app/views/dmsf_mailer/files_updated.text.erb index ed7d4be5..b2829104 100644 --- a/app/views/dmsf_mailer/files_updated.text.erb +++ b/app/views/dmsf_mailer/files_updated.text.erb @@ -18,7 +18,7 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.%> -<%= @author.name %> <%= l(:text_email_doc_updated) if @author %> +<%= @author.name %> <%= l(:text_email_doc_updated) %> <%= @project.name %> <%= l(:text_email_doc_follows) %> <% @files.each do |file| %> <%= h(file.dmsf_path_str) %> (<%= file.name %>),