Commit e2d81184 authored by Igor Drozdov's avatar Igor Drozdov

Remove format-js responder for logs_tree action

We don't load logs tree as dataType: script anymore
when this endpoint is call with this format the exception
is raised
parent b9e63044
...@@ -57,22 +57,11 @@ class Projects::RefsController < Projects::ApplicationController ...@@ -57,22 +57,11 @@ class Projects::RefsController < Projects::ApplicationController
render json: logs render json: logs
end end
# 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
@logs, _ = tree_summary.summarize
@more_log_url = more_url(tree_summary.next_offset) if tree_summary.more?
end
end end
end end
private private
def more_url(offset)
logs_file_project_ref_path(@project, @ref, @path, offset: offset)
end
def validate_ref_id def validate_ref_id
return not_found! if params[:id].present? && params[:id] !~ Gitlab::PathRegex.git_reference_regex return not_found! if params[:id].present? && params[:id] !~ Gitlab::PathRegex.git_reference_regex
end end
......
- @logs.each do |content_data|
- file_name = content_data[:file_name]
- commit = content_data[:commit]
- next unless commit
:plain
var row = $("table.table_#{@hex_path} tr.file_#{hexdigest(file_name)}");
row.find("td.tree-time-ago").html('#{escape_javascript time_ago_with_tooltip(commit.committed_date)}');
row.find("td.tree-commit").html('#{escape_javascript render("projects/tree/tree_commit_column", commit: commit)}');
= render_if_exists 'projects/refs/logs_tree_lock_label', lock_label: content_data[:lock_label]
- if @more_log_url
:plain
if($('#tree-slider').length) {
// Load more commit logs for each file in tree
// if we still on the same page
var url = "#{escape_javascript(@more_log_url)}";
gl.utils.ajaxGet(url);
}
:plain
gl.utils.localTimeAgo($('.js-timeago', 'table.table_#{@hex_path} tbody'));
- full_title = markdown_field(commit, :full_title)
%span.str-truncated
= link_to_html full_title, project_commit_path(@project, commit.id), title: full_title, class: 'tree-commit-link'
- lock_label = local_assigns.fetch(:lock_label)
- return unless lock_label
:plain
var label = $("<span>")
.attr('title', '#{escape_javascript lock_label.html_safe}')
.attr('data-toggle', 'tooltip')
.addClass('fa fa-lock prepend-left-5');
row.find('td.tree-item-file-name').append(label);
...@@ -41,19 +41,12 @@ RSpec.describe Projects::RefsController do ...@@ -41,19 +41,12 @@ RSpec.describe Projects::RefsController do
expect { xhr_get }.not_to raise_error expect { xhr_get }.not_to raise_error
end end
it 'renders 404 for non-JS requests' do it 'renders 404 for HTML requests' do
xhr_get xhr_get
expect(response).to be_not_found expect(response).to be_not_found
end end
it 'renders JS' do
expect(::Gitlab::GitalyClient).to receive(:allow_ref_name_caching).and_call_original
xhr_get(:js)
expect(response).to be_successful
end
context 'when json is requested' do context 'when json is requested' do
it 'renders JSON' do it 'renders JSON' do
expect(::Gitlab::GitalyClient).to receive(:allow_ref_name_caching).and_call_original expect(::Gitlab::GitalyClient).to receive(:allow_ref_name_caching).and_call_original
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment