diff options
Diffstat (limited to 'app/controllers/projects/refs_controller.rb')
-rw-r--r-- | app/controllers/projects/refs_controller.rb | 39 |
1 files changed, 13 insertions, 26 deletions
diff --git a/app/controllers/projects/refs_controller.rb b/app/controllers/projects/refs_controller.rb index 7c606bd8c45..fcbeb5c840c 100644 --- a/app/controllers/projects/refs_controller.rb +++ b/app/controllers/projects/refs_controller.rb @@ -12,7 +12,7 @@ class Projects::RefsController < Projects::ApplicationController before_action :authorize_download_code! before_action only: [:logs_tree] do - push_frontend_feature_flag(:vue_file_list_lfs_badge) + push_frontend_feature_flag(:vue_file_list_lfs_badge, default_enabled: true) end def switch @@ -44,30 +44,25 @@ class Projects::RefsController < Projects::ApplicationController end def logs_tree - summary = ::Gitlab::TreeSummary.new( - @commit, - @project, - path: @path, - offset: params[:offset], - limit: 25 - ) - - @logs, commits = summary.summarize - @more_log_url = more_url(summary.next_offset) if summary.more? + tree_summary = ::Gitlab::TreeSummary.new( + @commit, @project, current_user, + path: @path, offset: params[:offset], limit: 25) respond_to do |format| format.html { render_404 } format.json do - response.headers["More-Logs-Url"] = @more_log_url if summary.more? - response.headers["More-Logs-Offset"] = summary.next_offset if summary.more? - render json: @logs + logs, next_offset = tree_summary.fetch_logs + + response.headers["More-Logs-Offset"] = next_offset if next_offset + + render json: logs end - # The commit titles must be rendered and redacted before being shown. - # Doing it here allows us to apply performance optimizations that avoid - # N+1 problems + # Deprecated due to https://gitlab.com/gitlab-org/gitlab/-/issues/36863 + # Will be removed soon https://gitlab.com/gitlab-org/gitlab/-/merge_requests/29895 format.js do - prerender_commit_full_titles!(commits) + @logs, _ = tree_summary.summarize + @more_log_url = more_url(tree_summary.next_offset) if tree_summary.more? end end end @@ -78,14 +73,6 @@ class Projects::RefsController < Projects::ApplicationController logs_file_project_ref_path(@project, @ref, @path, offset: offset) end - def prerender_commit_full_titles!(commits) - # Preload commit authors as they are used in rendering - commits.each(&:lazy_author) - - renderer = Banzai::ObjectRenderer.new(user: current_user, default_project: @project) - renderer.render(commits, :full_title) - end - def validate_ref_id return not_found! if params[:id].present? && params[:id] !~ Gitlab::PathRegex.git_reference_regex end |