Commit 4372ad35 authored by Bob Van Landuyt's avatar Bob Van Landuyt

Merge branch 'id-rm-logs-tree-js' into 'master'

Remove format-js responder for logs_tree action

See merge request gitlab-org/gitlab!29895
parents 870ed3d9 e2d81184
......@@ -57,22 +57,11 @@ class Projects::RefsController < Projects::ApplicationController
render json: logs
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
private
def more_url(offset)
logs_file_project_ref_path(@project, @ref, @path, offset: offset)
end
def validate_ref_id
return not_found! if params[:id].present? && params[:id] !~ Gitlab::PathRegex.git_reference_regex
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
expect { xhr_get }.not_to raise_error
end
it 'renders 404 for non-JS requests' do
it 'renders 404 for HTML requests' do
xhr_get
expect(response).to be_not_found
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
it 'renders JSON' do
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