From 6a0178d8324964489654eb26fbefcb90bbcd1147 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rub=C3=A9n=20D=C3=A1vila?= Date: Wed, 13 Jun 2018 11:57:18 -0500 Subject: [PATCH] Invalidate cache with project details when repository is updated The partial using this cache key was showing stale information due to the cache not being invalidated. --- app/helpers/projects_helper.rb | 1 + ...created-date-instead-of-updated-date-in-project-lists.yml | 5 +++++ spec/helpers/projects_helper_spec.rb | 4 ++++ 3 files changed, 10 insertions(+) create mode 100644 changelogs/unreleased/rd-33733-showing-created-date-instead-of-updated-date-in-project-lists.yml diff --git a/app/helpers/projects_helper.rb b/app/helpers/projects_helper.rb index cdbb572f80a..e847baf0d52 100644 --- a/app/helpers/projects_helper.rb +++ b/app/helpers/projects_helper.rb @@ -171,6 +171,7 @@ module ProjectsHelper key = [ project.route.cache_key, project.cache_key, + project.last_activity_date, controller.controller_name, controller.action_name, Gitlab::CurrentSettings.cache_key, diff --git a/changelogs/unreleased/rd-33733-showing-created-date-instead-of-updated-date-in-project-lists.yml b/changelogs/unreleased/rd-33733-showing-created-date-instead-of-updated-date-in-project-lists.yml new file mode 100644 index 00000000000..3934381b0cf --- /dev/null +++ b/changelogs/unreleased/rd-33733-showing-created-date-instead-of-updated-date-in-project-lists.yml @@ -0,0 +1,5 @@ +--- +title: Invalidate cache with project details when repository is updated +merge_request: 19774 +author: +type: fixed diff --git a/spec/helpers/projects_helper_spec.rb b/spec/helpers/projects_helper_spec.rb index d372e58f63d..815b4035114 100644 --- a/spec/helpers/projects_helper_spec.rb +++ b/spec/helpers/projects_helper_spec.rb @@ -90,6 +90,10 @@ describe ProjectsHelper do expect(helper.project_list_cache_key(project)).to include(project.cache_key) end + it "includes the last activity date" do + expect(helper.project_list_cache_key(project)).to include(project.last_activity_date) + end + it "includes the controller name" do expect(helper.controller).to receive(:controller_name).and_return("testcontroller")