Moving a file or folder must also invalidate the source folder

This commit is contained in:
COLA@Redmine.local 2017-02-22 19:03:53 +01:00
parent 967e3e6d5a
commit 6c539ec85b
2 changed files with 8 additions and 0 deletions

View File

@ -260,6 +260,9 @@ class DmsfFile < ActiveRecord::Base
end
end
end
# Must invalidate source parent folder cache before moving
RedmineDmsf::Webdav::Cache.invalidate_item(propfind_cache_key)
self.container_type = self.container_type
self.container_id = container.id

View File

@ -273,6 +273,9 @@ module RedmineDmsf
if dest.exist?
MethodNotAllowed
else
# Must invalidate source parent folder cache before moving
RedmineDmsf::Webdav::Cache.invalidate_item(folder.propfind_cache_key)
if(parent.projectless_path == '/') #Project root
folder.dmsf_folder_id = nil
else
@ -337,6 +340,8 @@ module RedmineDmsf
else
if (project == resource.project) && (file.last_revision.size == 0)
# Moving a zero sized file within the same project, just update the dmsf_folder
# Must invalidate source parent folder cache before moving
RedmineDmsf::Webdav::Cache.invalidate_item(file.propfind_cache_key)
file.dmsf_folder = f
else
return InternalServerError unless file.move_to(resource.project, f)