Fix the build.

This commit is contained in:
Guo Xiang Tan 2019-03-13 17:39:07 +08:00
parent b0c8fdd7da
commit 243fb8d9ad
4 changed files with 5 additions and 4 deletions

View File

@ -129,7 +129,7 @@ module FileStore
S3Inventory.new(s3_helper, :upload).backfill_etags_and_list_missing
S3Inventory.new(s3_helper, :optimized).backfill_etags_and_list_missing unless skip_optimized
else
list_missing(Upload, "original/")
list_missing(Upload.by_users, "original/")
list_missing(OptimizedImage, "optimized/") unless skip_optimized
end
end

View File

@ -54,7 +54,7 @@ class S3Inventory
WHERE #{model.table_name}.etag IS NULL
AND url ILIKE '%' || #{table_name}.key")
uploads = (model == Upload) ? model.where("created_at < ?", inventory_date) : model
uploads = (model == Upload) ? model.by_users.where("created_at < ?", inventory_date) : model
missing_uploads = uploads.joins("LEFT JOIN #{table_name} ON #{table_name}.etag = #{model.table_name}.etag").where("#{table_name}.etag is NULL")
if (missing_count = missing_uploads.count) > 0

View File

@ -61,6 +61,7 @@ describe "S3Inventory" do
CSV.foreach(csv_filename, headers: false) do |row|
Fabricate(:upload, etag: row[S3Inventory::CSV_ETAG_INDEX], created_at: 2.days.ago)
end
upload = Fabricate(:upload, etag: "ETag", created_at: 1.days.ago)
Fabricate(:upload, etag: "ETag2", created_at: Time.now)
@ -91,6 +92,6 @@ describe "S3Inventory" do
expect { inventory.backfill_etags_and_list_missing }.to change { Upload.where(etag: nil).count }.by(-2)
end
expect(Upload.order(:url).pluck(:url, :etag)).to eq(files)
expect(Upload.by_users.order(:url).pluck(:url, :etag)).to eq(files)
end
end

View File

@ -274,7 +274,7 @@ describe ApplicationHelper do
).to include("some-image.png")
expect(helper.crawlable_meta_data).to include(
SiteSetting.opengraph_image_url
SiteSetting.site_opengraph_image_url
)
SiteSetting.opengraph_image = nil