Merge branch '38261-remove-unused-code' into 'master'
Remove two unused formats from Projects::TreeController#show Closes #38261 See merge request gitlab-org/gitlab-ce!25249
This commit is contained in:
commit
b166398307
|
@ -31,20 +31,6 @@ class Projects::TreeController < Projects::ApplicationController
|
|||
lfs_blob_ids
|
||||
@last_commit = @repository.last_commit_for_path(@commit.id, @tree.path) || @commit
|
||||
end
|
||||
|
||||
format.js do
|
||||
# Disable cache so browser history works
|
||||
no_cache_headers
|
||||
end
|
||||
|
||||
format.json do
|
||||
page_title @path.presence || _("Files"), @ref, @project.full_name
|
||||
|
||||
# n+1: https://gitlab.com/gitlab-org/gitlab-ce/issues/38261
|
||||
Gitlab::GitalyClient.allow_n_plus_1_calls do
|
||||
render json: TreeSerializer.new(project: @project, repository: @repository, ref: @ref).represent(@tree)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -1,15 +0,0 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
class TreeEntity < Grape::Entity
|
||||
include RequestAwareEntity
|
||||
|
||||
expose :id, :path, :name, :mode
|
||||
|
||||
expose :icon do |tree|
|
||||
IconsHelper.file_type_icon_class('folder', tree.mode, tree.name)
|
||||
end
|
||||
|
||||
expose :url do |tree|
|
||||
project_tree_path(request.project, File.join(request.ref, tree.path))
|
||||
end
|
||||
end
|
|
@ -1,27 +0,0 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
# TODO: Inherit from TreeEntity, when `Tree` implements `id` and `name` like `Gitlab::Git::Tree`.
|
||||
class TreeRootEntity < Grape::Entity
|
||||
include RequestAwareEntity
|
||||
|
||||
expose :path
|
||||
|
||||
expose :trees, using: TreeEntity
|
||||
expose :blobs, using: BlobEntity
|
||||
expose :submodules, using: SubmoduleEntity
|
||||
|
||||
expose :parent_tree_url do |tree|
|
||||
path = tree.path.sub(%r{\A/}, '')
|
||||
next unless path.present?
|
||||
|
||||
path_segments = path.split('/')
|
||||
path_segments.pop
|
||||
parent_tree_path = path_segments.join('/')
|
||||
|
||||
project_tree_path(request.project, File.join(request.ref, parent_tree_path))
|
||||
end
|
||||
|
||||
expose :last_commit_path do |tree|
|
||||
logs_file_project_ref_path(request.project, request.ref, tree.path)
|
||||
end
|
||||
end
|
|
@ -1,5 +0,0 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
class TreeSerializer < BaseSerializer
|
||||
entity TreeRootEntity
|
||||
end
|
Loading…
Reference in New Issue