docbrown/app/services/edge_cache/bust_user.rb
Daniel Uber 3e432c9047
When busting user cache, also clear the api response (#13465)
* When busting user cache, also clear the api response

This should fix #13293 by clearing both the UI copy and the api copy of the
user's page.

* Update spec to include the api path
2021-04-22 09:16:15 -05:00

24 lines
555 B
Ruby

module EdgeCache
class BustUser
def self.call(user)
return unless user
username = user.username
user_id = user.id
paths = [
"/#{username}",
"/#{username}?i=i",
"/#{username}/comments",
"/#{username}/comments?i=i",
"/#{username}/comments/?i=i",
"/live/#{username}",
"/live/#{username}?i=i",
"/feed/#{username}",
"/api/users/#{user_id}",
]
cache_bust = EdgeCache::Bust.new
paths.each { |path| cache_bust.call(path) }
end
end
end