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

whats_new_helper.rb « helpers « app - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: c183ed7f12abc6994a0580b635aa9a8ec17c0f79 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# frozen_string_literal: true

module WhatsNewHelper
  include Gitlab::WhatsNew

  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

  def whats_new_storage_key
    return unless whats_new_most_recent_version

    ['display-whats-new-notification', whats_new_most_recent_version].join('-')
  end

  private

  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
  end
end