Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-10-21 10:08:36 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2020-10-21 10:08:36 +0300
commit48aff82709769b098321c738f3444b9bdaa694c6 (patch)
treee00c7c43e2d9b603a5a6af576b1685e400410dee /lib/gitlab/whats_new.rb
parent879f5329ee916a948223f8f43d77fba4da6cd028 (diff)
Add latest changes from gitlab-org/gitlab@13-5-stable-eev13.5.0-rc42
Diffstat (limited to 'lib/gitlab/whats_new.rb')
-rw-r--r--lib/gitlab/whats_new.rb28
1 files changed, 28 insertions, 0 deletions
diff --git a/lib/gitlab/whats_new.rb b/lib/gitlab/whats_new.rb
new file mode 100644
index 00000000000..e95ace2c475
--- /dev/null
+++ b/lib/gitlab/whats_new.rb
@@ -0,0 +1,28 @@
+# frozen_string_literal: true
+
+module Gitlab
+ module WhatsNew
+ CACHE_DURATION = 1.day
+ WHATS_NEW_FILES_PATH = Rails.root.join('data', 'whats_new', '*.yml')
+
+ private
+
+ def whats_new_most_recent_release_items
+ Rails.cache.fetch('whats_new:release_items', expires_in: CACHE_DURATION) do
+ file = File.read(most_recent_release_file_path)
+
+ items = YAML.safe_load(file, permitted_classes: [Date])
+
+ items if items.is_a?(Array)
+ end
+ rescue => e
+ Gitlab::ErrorTracking.track_exception(e, yaml_file_path: most_recent_release_file_path)
+
+ nil
+ end
+
+ def most_recent_release_file_path
+ @most_recent_release_file_path ||= Dir.glob(WHATS_NEW_FILES_PATH).max
+ end
+ end
+end