debian-mirror-gitlab/app/helpers/whats_new_helper.rb

28 lines
773 B
Ruby
Raw Normal View History

2020-11-24 15:15:51 +05:30
# frozen_string_literal: true
module WhatsNewHelper
2021-01-03 14:25:43 +05:30
include Gitlab::WhatsNew
2020-11-24 15:15:51 +05:30
2021-01-03 14:25:43 +05:30
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
2020-11-24 15:15:51 +05:30
2021-01-03 14:25:43 +05:30
def whats_new_storage_key
return unless whats_new_most_recent_version
2020-11-24 15:15:51 +05:30
2021-01-03 14:25:43 +05:30
['display-whats-new-notification', whats_new_most_recent_version].join('-')
2020-11-24 15:15:51 +05:30
end
private
2021-01-03 14:25:43 +05:30
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
2020-11-24 15:15:51 +05:30
end
end