From 3e432c9047a34a23a1bc0782f6a881efe08f81a9 Mon Sep 17 00:00:00 2001 From: Daniel Uber Date: Thu, 22 Apr 2021 09:16:15 -0500 Subject: [PATCH] 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 --- app/services/edge_cache/bust_user.rb | 3 ++- spec/services/edge_cache/bust_user_spec.rb | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/app/services/edge_cache/bust_user.rb b/app/services/edge_cache/bust_user.rb index 4047c34d8..259074aa3 100644 --- a/app/services/edge_cache/bust_user.rb +++ b/app/services/edge_cache/bust_user.rb @@ -4,7 +4,7 @@ module EdgeCache return unless user username = user.username - + user_id = user.id paths = [ "/#{username}", "/#{username}?i=i", @@ -14,6 +14,7 @@ module EdgeCache "/live/#{username}", "/live/#{username}?i=i", "/feed/#{username}", + "/api/users/#{user_id}", ] cache_bust = EdgeCache::Bust.new diff --git a/spec/services/edge_cache/bust_user_spec.rb b/spec/services/edge_cache/bust_user_spec.rb index 71137c84c..6090ce93c 100644 --- a/spec/services/edge_cache/bust_user_spec.rb +++ b/spec/services/edge_cache/bust_user_spec.rb @@ -16,6 +16,7 @@ RSpec.describe EdgeCache::BustUser, type: :service do "/live/#{username}", "/live/#{username}?i=i", "/feed/#{username}", + "/api/users/#{user.id}", ] end