summaryrefslogtreecommitdiff
path: root/app/controllers/whats_new_controller.rb
diff options
context:
space:
mode:
Diffstat (limited to 'app/controllers/whats_new_controller.rb')
-rw-r--r--app/controllers/whats_new_controller.rb27
1 files changed, 7 insertions, 20 deletions
diff --git a/app/controllers/whats_new_controller.rb b/app/controllers/whats_new_controller.rb
index cba86c65848..6ed15d9b127 100644
--- a/app/controllers/whats_new_controller.rb
+++ b/app/controllers/whats_new_controller.rb
@@ -1,19 +1,16 @@
# frozen_string_literal: true
class WhatsNewController < ApplicationController
- include Gitlab::Utils::StrongMemoize
-
skip_before_action :authenticate_user!
- before_action :check_feature_flag
- before_action :check_valid_page_param, :set_pagination_headers, unless: -> { has_version_param? }
+ before_action :check_feature_flag, :check_valid_page_param, :set_pagination_headers
feature_category :navigation
def index
respond_to do |format|
format.js do
- render json: highlight_items
+ render json: most_recent_items
end
end
end
@@ -32,25 +29,15 @@ class WhatsNewController < ApplicationController
params[:page]&.to_i || 1
end
- def highlights
- strong_memoize(:highlights) do
- if has_version_param?
- ReleaseHighlight.for_version(version: params[:version])
- else
- ReleaseHighlight.paginated(page: current_page)
- end
- end
+ def most_recent
+ @most_recent ||= ReleaseHighlight.paginated(page: current_page)
end
- def highlight_items
- highlights.map {|item| Gitlab::WhatsNew::ItemPresenter.present(item) }
+ def most_recent_items
+ most_recent[:items].map {|item| Gitlab::WhatsNew::ItemPresenter.present(item) }
end
def set_pagination_headers
- response.set_header('X-Next-Page', highlights.next_page)
- end
-
- def has_version_param?
- params[:version].present?
+ response.set_header('X-Next-Page', most_recent[:next_page])
end
end