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:
Diffstat (limited to 'app/models/release_highlight.rb')
-rw-r--r--app/models/release_highlight.rb16
1 files changed, 15 insertions, 1 deletions
diff --git a/app/models/release_highlight.rb b/app/models/release_highlight.rb
index 7cead8a42cd..5a6f708f689 100644
--- a/app/models/release_highlight.rb
+++ b/app/models/release_highlight.rb
@@ -8,6 +8,12 @@ class ReleaseHighlight
ULTIMATE_PACKAGE = 'Ultimate'
def self.paginated(page: 1)
+ result = self.paginated_query(page: page)
+ result = self.paginated_query(page: result.next_page) while next_page?(result)
+ result
+ end
+
+ def self.paginated_query(page:)
key = self.cache_key("items:page-#{page}")
Rails.cache.fetch(key, expires_in: CACHE_DURATION) do
@@ -44,7 +50,7 @@ class ReleaseHighlight
rescue Psych::Exception => e
Gitlab::ErrorTracking.track_exception(e, file_path: file_path)
- nil
+ []
end
def self.whats_new_path
@@ -121,6 +127,14 @@ class ReleaseHighlight
item['available_in']&.include?(current_package)
end
+
+ def self.next_page?(result)
+ return false unless result
+
+ # if all items for the current page doesn't belong to the current tier
+ # or failed to parse current YAML, loading next page
+ result.items == [] && result.next_page.present?
+ end
end
ReleaseHighlight.prepend_mod