posts: purge all cached URLs when post is regenerated
Fix not all URLs being purged from Cloudflare when a post is regenerated.
This commit is contained in:
@@ -125,12 +125,12 @@ class Post < ApplicationRecord
|
|||||||
storage_manager.open_file(self, type)
|
storage_manager.open_file(self, type)
|
||||||
end
|
end
|
||||||
|
|
||||||
def tagged_file_url
|
def tagged_file_url(tagged_filenames: !CurrentUser.user.disable_tagged_filenames?)
|
||||||
storage_manager.file_url(self, :original, tagged_filenames: !CurrentUser.user.disable_tagged_filenames?)
|
storage_manager.file_url(self, :original, tagged_filenames: tagged_filenames)
|
||||||
end
|
end
|
||||||
|
|
||||||
def tagged_large_file_url
|
def tagged_large_file_url(tagged_filenames: !CurrentUser.user.disable_tagged_filenames?)
|
||||||
storage_manager.file_url(self, :large, tagged_filenames: !CurrentUser.user.disable_tagged_filenames?)
|
storage_manager.file_url(self, :large, tagged_filenames: tagged_filenames)
|
||||||
end
|
end
|
||||||
|
|
||||||
def file_url
|
def file_url
|
||||||
@@ -1368,7 +1368,11 @@ class Post < ApplicationRecord
|
|||||||
end
|
end
|
||||||
|
|
||||||
def purge_cached_urls!
|
def purge_cached_urls!
|
||||||
urls = [preview_file_url, large_file_url]
|
urls = [
|
||||||
|
preview_file_url, crop_file_url, large_file_url, file_url,
|
||||||
|
tagged_file_url(tagged_filenames: true), tagged_large_file_url(tagged_filenames: true)
|
||||||
|
]
|
||||||
|
|
||||||
CloudflareService.new.purge_cache(urls)
|
CloudflareService.new.purge_cache(urls)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user