diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-10-21 10:08:36 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-10-21 10:08:36 +0300 |
commit | 48aff82709769b098321c738f3444b9bdaa694c6 (patch) | |
tree | e00c7c43e2d9b603a5a6af576b1685e400410dee /app/helpers/whats_new_helper.rb | |
parent | 879f5329ee916a948223f8f43d77fba4da6cd028 (diff) |
Add latest changes from gitlab-org/gitlab@13-5-stable-eev13.5.0-rc42
Diffstat (limited to 'app/helpers/whats_new_helper.rb')
-rw-r--r-- | app/helpers/whats_new_helper.rb | 27 |
1 files changed, 15 insertions, 12 deletions
diff --git a/app/helpers/whats_new_helper.rb b/app/helpers/whats_new_helper.rb index f0044daa645..c183ed7f12a 100644 --- a/app/helpers/whats_new_helper.rb +++ b/app/helpers/whats_new_helper.rb @@ -1,24 +1,27 @@ # frozen_string_literal: true module WhatsNewHelper - EMPTY_JSON = ''.to_json + include Gitlab::WhatsNew - def whats_new_most_recent_release_items - YAML.load_file(most_recent_release_file_path).to_json + def whats_new_most_recent_release_items_count + Gitlab::ProcessMemoryCache.cache_backend.fetch('whats_new:release_items_count', expires_in: CACHE_DURATION) do + whats_new_most_recent_release_items&.count + end + end - rescue => e - Gitlab::ErrorTracking.track_exception(e, yaml_file_path: most_recent_release_file_path) + def whats_new_storage_key + return unless whats_new_most_recent_version - EMPTY_JSON + ['display-whats-new-notification', whats_new_most_recent_version].join('-') end private - def most_recent_release_file_path - Dir.glob(files_path).max - end - - def files_path - Rails.root.join('data', 'whats_new', '*.yml') + def whats_new_most_recent_version + Gitlab::ProcessMemoryCache.cache_backend.fetch('whats_new:release_version', expires_in: CACHE_DURATION) do + if whats_new_most_recent_release_items + whats_new_most_recent_release_items.first.try(:[], 'release') + end + end end end |