Email notification failures when files are locked fixed

This commit is contained in:
Karel Picman 2013-08-16 15:37:45 +02:00
parent beb1ef34ba
commit de9370961a
7 changed files with 14 additions and 35 deletions

View File

@ -125,7 +125,7 @@ class DmsfFilesController < ApplicationController
begin
DmsfMailer.files_updated(User.current, [@file]).deliver
rescue ActionView::MissingTemplate => e
Rails.logger.error "Could not send email notifications: " + e
Rails.logger.error "Could not send email notifications: #{e.message}"
end
redirect_to :action => "show", :id => @file
else

View File

@ -72,7 +72,7 @@ class DmsfFilesCopyController < ApplicationController
begin
DmsfMailer.files_updated(User.current, [new_file]).deliver
rescue ActionView::MissingTemplate => e
Rails.logger.error "Could not send email notifications: " + e
Rails.logger.error "Could not send email notifications: #{e.message}"
end
redirect_to :controller => "dmsf_files", :action => "show", :id => new_file
@ -110,7 +110,7 @@ class DmsfFilesCopyController < ApplicationController
# TODO: implement proper mail notification
DmsfMailer.files_updated(User.current, [@file]).deliver
rescue ActionView::MissingTemplate => e
Rails.logger.error "Could not send email notifications: " + e
Rails.logger.error "Could not send email notifications: #{e.message}"
end
redirect_to :controller => "dmsf_files", :action => "show", :id => @file

View File

@ -125,7 +125,7 @@ class DmsfFile < ActiveRecord::Base
end
def title
self.last_revision.title
self.last_revision ? self.last_revision.title : self.name
end
def description
@ -150,10 +150,8 @@ class DmsfFile < ActiveRecord::Base
path
end
def dmsf_path_str
path = self.dmsf_path
string_path = path.map { |element| element.title }
string_path.join("/")
def dmsf_path_str
self.dmsf_path.map { |element| element.title }.join('/')
end
def notify?

View File

@ -8,9 +8,10 @@
deleted DMSF files in project <%= @project.name %>:
<% @files.each do |file| %>
<p>
<%= h(file.dmsf_path_str) %> (<%= file.name %>),
<%= number_to_human_size(file.last_revision.size) %>,
version: <%= file.last_revision.major_version %>.<%= file.last_revision.minor_version %>
<%= h(file.dmsf_path_str) %> (<%= file.name %>)
<% if file.last_revision %>
, <%= number_to_human_size(file.last_revision.size) %>, version: <%= file.last_revision.major_version %>.<%= file.last_revision.minor_version %>
<% end %>
</p>
<% end %>
</body>

View File

@ -1,5 +1,7 @@
User <%= @user %> deleted DMSF files in project <%= @project.name %>:
<% @files.each do |file| %>
<%= file.dmsf_path_str %> (<%= file.name %>), <%= number_to_human_size(file.last_revision.size) %>, version: <%= file.last_revision.major_version %>.<%= file.last_revision.minor_version %>
<%= file.dmsf_path_str %> (<%= file.name %>)
<% if file.last_revision %>
, <%= number_to_human_size(file.last_revision.size) %>, version: <%= file.last_revision.major_version %>.<%= file.last_revision.minor_version %>
<% end %>
<% end %>

View File

@ -1,17 +0,0 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type" />
</head>
<body>
User <%= link_to(h(@user), {:only_path => false, :controller => "users", :action => "show", :id => @user }) %>
deleted DMSF files in project <%= @project.name %>:
<% @files.each do |file| %>
<p>
<%= h(file.dmsf_path_str) %> (<%= file.name %>),
<%= number_to_human_size(file.last_revision.size) %>,
version: <%= file.last_revision.major_version %>.<%= file.last_revision.minor_version %>
</p>
<% end %>
</body>
</html>

View File

@ -1,5 +0,0 @@
User <%= @user %> deleted DMSF files in project <%= @project.name %>:
<% @files.each do |file| %>
<%= file.dmsf_path_str %> (<%= file.name %>), <%= number_to_human_size(file.last_revision.size) %>, version: <%= file.last_revision.major_version %>.<%= file.last_revision.minor_version %>
<% end %>