FIX: `Upload#migrate_to_new_scheme` should not migrate system uploads.
This commit is contained in:
parent
1bc96177dd
commit
40b03e717b
|
@ -224,7 +224,10 @@ class Upload < ActiveRecord::Base
|
|||
max_file_size_kb = [SiteSetting.max_image_size_kb, SiteSetting.max_attachment_size_kb].max.kilobytes
|
||||
local_store = FileStore::LocalStore.new
|
||||
|
||||
scope = Upload.where("url NOT LIKE '%/original/_X/%'").order(id: :desc)
|
||||
scope = Upload.by_users
|
||||
.where("url NOT LIKE '%/original/_X/%'")
|
||||
.order(id: :desc)
|
||||
|
||||
scope = scope.limit(limit) if limit
|
||||
|
||||
scope.each do |upload|
|
||||
|
|
|
@ -250,4 +250,13 @@ describe Upload do
|
|||
end
|
||||
end
|
||||
|
||||
describe '.migrate_to_new_scheme' do
|
||||
it 'should not migrate system uploads' do
|
||||
SiteSetting.migrate_to_new_scheme = true
|
||||
|
||||
expect { Upload.migrate_to_new_scheme }
|
||||
.to_not change { Upload.pluck(:url) }
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue