No journal when delete / de-attach document #1365
This commit is contained in:
parent
5dce7c284c
commit
92d0cf90ae
@ -207,7 +207,12 @@ class DmsfFilesController < ApplicationController
|
||||
result = @file.delete(commit)
|
||||
if result
|
||||
flash[:notice] = l(:notice_file_deleted)
|
||||
unless commit
|
||||
if commit
|
||||
container = @file.container
|
||||
if container
|
||||
container.dmsf_file_removed @file
|
||||
end
|
||||
else
|
||||
begin
|
||||
recipients = DmsfMailer.deliver_files_deleted(@project, [@file])
|
||||
if Setting.plugin_redmine_dmsf['dmsf_display_notified_recipients']
|
||||
|
||||
@ -94,7 +94,7 @@ module DmsfUploadHelper
|
||||
FileUtils.chmod 'u=wr,g=r', new_revision.disk_file(false)
|
||||
file.set_last_revision new_revision
|
||||
files.push file
|
||||
if container && container.is_a?(Issue) && (!new_object)
|
||||
if container && (!new_object)
|
||||
container.dmsf_file_added file
|
||||
end
|
||||
Redmine::Hook.call_hook :dmsf_helper_upload_after_commit, { file: file }
|
||||
|
||||
@ -606,7 +606,7 @@ class DmsfFile < ActiveRecord::Base
|
||||
target = File.join(Attachment.thumbnails_storage_path, "#{id}_#{last_revision.digest}_#{size}.thumb")
|
||||
|
||||
begin
|
||||
Redmine::Thumbnail.generate(last_revision.disk_file.to_s, target, size)
|
||||
Redmine::Thumbnail.generate last_revision.disk_file.to_s, target, size
|
||||
rescue => e
|
||||
Rails.logger.error "An error occured while generating thumbnail for #{last_revision.disk_file} to #{target}\nException was: #{e.message}"
|
||||
nil
|
||||
@ -625,4 +625,14 @@ class DmsfFile < ActiveRecord::Base
|
||||
l(:title_unlock_file)
|
||||
end
|
||||
|
||||
def container
|
||||
if dmsf_folder&.system && dmsf_folder.title.match(/(^\d+)/)
|
||||
issue_id = $1
|
||||
parent = dmsf_folder.dmsf_folder
|
||||
if parent && parent.title.match(/^\.(.+)s/)
|
||||
$1.constantize.visible.find_by(id: issue_id)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user