Commit 972775f4 authored by Igor Drozdov's avatar Igor Drozdov

Remove file type checking for diff viewers

parent 1f32e55e
...@@ -4,7 +4,7 @@ module DiffViewer ...@@ -4,7 +4,7 @@ module DiffViewer
class Base class Base
PARTIAL_PATH_PREFIX = 'projects/diffs/viewers' PARTIAL_PATH_PREFIX = 'projects/diffs/viewers'
class_attribute :partial_name, :type, :extensions, :file_types, :binary, :switcher_icon, :switcher_title class_attribute :partial_name, :type, :extensions, :binary, :switcher_icon, :switcher_title
# These limits relate to the sum of the old and new blob sizes. # These limits relate to the sum of the old and new blob sizes.
# Limits related to the actual size of the diff are enforced in Gitlab::Diff::File. # Limits related to the actual size of the diff are enforced in Gitlab::Diff::File.
...@@ -50,7 +50,6 @@ module DiffViewer ...@@ -50,7 +50,6 @@ module DiffViewer
return true if blob.nil? return true if blob.nil?
return false if verify_binary && binary? != blob.binary_in_repo? return false if verify_binary && binary? != blob.binary_in_repo?
return true if extensions&.include?(blob.extension) return true if extensions&.include?(blob.extension)
return true if file_types&.include?(blob.file_type)
false false
end end
......
...@@ -43,34 +43,6 @@ describe DiffViewer::Base do ...@@ -43,34 +43,6 @@ describe DiffViewer::Base do
end end
end end
context 'when the file type is supported' do
let(:commit) { project.commit('1a0b36b3cdad1d2ee32457c102a8c0b7056fa863') }
let(:diff_file) { commit.diffs.diff_file_with_new_path('LICENSE') }
before do
viewer_class.file_types = %i(license)
viewer_class.binary = false
end
context 'when the binaryness matches' do
it 'returns true' do
expect(viewer_class.can_render?(diff_file)).to be_truthy
end
end
context 'when the binaryness does not match' do
before do
allow_next_instance_of(Blob) do |instance|
allow(instance).to receive(:binary_in_repo?).and_return(true)
end
end
it 'returns false' do
expect(viewer_class.can_render?(diff_file)).to be_falsey
end
end
end
context 'when the extension and file type are not supported' do context 'when the extension and file type are not supported' do
it 'returns false' do it 'returns false' do
expect(viewer_class.can_render?(diff_file)).to be_falsey expect(viewer_class.can_render?(diff_file)).to be_falsey
......
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