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

26 lines
688 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
2021-01-29 00:20:46 +05:30
whats_new_release_items&.count
2021-01-03 14:25:43 +05:30
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
2021-01-29 00:20:46 +05:30
whats_new_release_items&.first&.[]('release')
2021-01-03 14:25:43 +05:30
end
2020-11-24 15:15:51 +05:30
end
end