diff options
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 |