diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-09-28 21:09:40 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-09-28 21:09:40 +0300 |
commit | dce57587960022ca3582bedfc5bcf356893fe603 (patch) | |
tree | 0e671ae3f22ccb61a3a3c5a15b53f899576e7542 /app/helpers/whats_new_helper.rb | |
parent | 34b3acb5a3a9b21490e45b81b81dca600b66521c (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/helpers/whats_new_helper.rb')
-rw-r--r-- | app/helpers/whats_new_helper.rb | 22 |
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 |