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-05 16:54:15 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2020-10-05 16:54:15 +0300
commitbe834a25982746ffd85252ff502df42bb88cb9d5 (patch)
treeb4d6a8ba0931e12fac08f05abea33a3b8ec2c8a2 /app/helpers/whats_new_helper.rb
parentee925a3597f27e92f83a50937a64068109675b3d (diff)
Add latest changes from gitlab-org/gitlab@13-5-stable-eev13.5.0-rc32
Diffstat (limited to 'app/helpers/whats_new_helper.rb')
-rw-r--r--app/helpers/whats_new_helper.rb22
1 files changed, 22 insertions, 0 deletions
diff --git a/app/helpers/whats_new_helper.rb b/app/helpers/whats_new_helper.rb
index f0044daa645..edb3544d2d4 100644
--- a/app/helpers/whats_new_helper.rb
+++ b/app/helpers/whats_new_helper.rb
@@ -3,6 +3,24 @@
module WhatsNewHelper
EMPTY_JSON = ''.to_json
+ def whats_new_most_recent_release_items_count
+ items = parsed_most_recent_release_items
+
+ return unless items.is_a?(Array)
+
+ items.count
+ end
+
+ def whats_new_storage_key
+ items = parsed_most_recent_release_items
+
+ return unless items.is_a?(Array)
+
+ release = items.first.try(:[], 'release')
+
+ ['display-whats-new-notification', release].compact.join('-')
+ end
+
def whats_new_most_recent_release_items
YAML.load_file(most_recent_release_file_path).to_json
@@ -14,6 +32,10 @@ module WhatsNewHelper
private
+ def parsed_most_recent_release_items
+ Gitlab::Json.parse(whats_new_most_recent_release_items)
+ end
+
def most_recent_release_file_path
Dir.glob(files_path).max
end