diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-12-17 14:59:07 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-12-17 14:59:07 +0300 |
commit | 8b573c94895dc0ac0e1d9d59cf3e8745e8b539ca (patch) | |
tree | 544930fb309b30317ae9797a9683768705d664c4 /lib/gitlab/whats_new.rb | |
parent | 4b1de649d0168371549608993deac953eb692019 (diff) |
Add latest changes from gitlab-org/gitlab@13-7-stable-eev13.7.0-rc42
Diffstat (limited to 'lib/gitlab/whats_new.rb')
-rw-r--r-- | lib/gitlab/whats_new.rb | 40 |
1 files changed, 0 insertions, 40 deletions
diff --git a/lib/gitlab/whats_new.rb b/lib/gitlab/whats_new.rb deleted file mode 100644 index 69ccb48c544..00000000000 --- a/lib/gitlab/whats_new.rb +++ /dev/null @@ -1,40 +0,0 @@ -# frozen_string_literal: true - -module Gitlab - module WhatsNew - CACHE_DURATION = 1.hour - WHATS_NEW_FILES_PATH = Rails.root.join('data', 'whats_new', '*.yml') - - private - - def whats_new_release_items(page: 1) - Rails.cache.fetch(whats_new_items_cache_key(page), expires_in: CACHE_DURATION) do - index = page - 1 - file_path = whats_new_file_paths[index] - - next if file_path.nil? - - file = File.read(file_path) - - items = YAML.safe_load(file, permitted_classes: [Date]) - - items if items.is_a?(Array) - end - rescue => e - Gitlab::ErrorTracking.track_exception(e, page: page) - - nil - end - - def whats_new_file_paths - @whats_new_file_paths ||= Rails.cache.fetch('whats_new:file_paths', expires_in: CACHE_DURATION) do - Dir.glob(WHATS_NEW_FILES_PATH).sort.reverse - end - end - - def whats_new_items_cache_key(page) - filename = /\d*\_\d*\_\d*/.match(whats_new_file_paths&.first) - "whats_new:release_items:file-#{filename}:page-#{page}" - end - end -end |