Remove snippet file_name in snippet lists

This commit removes the snippet file_name
from every snippet lists.
parent 6d8264b8
...@@ -160,14 +160,4 @@ module SnippetsHelper ...@@ -160,14 +160,4 @@ module SnippetsHelper
title: 'Download', title: 'Download',
rel: 'noopener noreferrer') rel: 'noopener noreferrer')
end end
def snippet_file_name(snippet)
blob = if Feature.enabled?(:version_snippets, current_user) && !snippet.repository.empty?
snippet.blobs.first
else
snippet.blob
end
blob.name
end
end end
- link_project = local_assigns.fetch(:link_project, false) - link_project = local_assigns.fetch(:link_project, false)
- notes_count = @noteable_meta_data[snippet.id].user_notes_count - notes_count = @noteable_meta_data[snippet.id].user_notes_count
- file_name = snippet_file_name(snippet)
%li.snippet-row.py-3 %li.snippet-row.py-3
= image_tag avatar_icon_for_user(snippet.author), class: "avatar s40 d-none d-sm-block", alt: '' = image_tag avatar_icon_for_user(snippet.author), class: "avatar s40 d-none d-sm-block", alt: ''
...@@ -8,10 +7,6 @@ ...@@ -8,10 +7,6 @@
.title .title
= link_to gitlab_snippet_path(snippet) do = link_to gitlab_snippet_path(snippet) do
= snippet.title = snippet.title
- if file_name.present?
%span.snippet-filename.d-none.d-sm-inline-block.ml-2
= sprite_icon('doc-code', size: 16, css_class: 'file-icon align-text-bottom')
= file_name
%ul.controls %ul.controls
%li %li
......
---
title: Remove snippet file_name from snippet lists
merge_request: 29937
author:
type: changed
...@@ -49,47 +49,6 @@ describe 'Dashboard snippets' do ...@@ -49,47 +49,6 @@ describe 'Dashboard snippets' do
end end
end end
context 'rendering file names' do
let_it_be(:snippet) { create(:personal_snippet, :public, author: user, file_name: 'foo.txt') }
let_it_be(:versioned_snippet) { create(:personal_snippet, :repository, :public, author: user, file_name: 'bar.txt') }
before do
sign_in(user)
end
context 'when feature flag :version_snippets is disabled' do
before do
stub_feature_flags(version_snippets: false)
visit dashboard_snippets_path
end
it 'contains the snippet file names from the DB' do
aggregate_failures do
expect(page).to have_content 'foo.txt'
expect(page).to have_content('bar.txt')
expect(page).not_to have_content('.gitattributes')
end
end
end
context 'when feature flag :version_snippets is enabled' do
before do
stub_feature_flags(version_snippets: true)
visit dashboard_snippets_path
end
it 'contains both the versioned and non-versioned filenames' do
aggregate_failures do
expect(page).to have_content 'foo.txt'
expect(page).to have_content('.gitattributes')
expect(page).not_to have_content('bar.txt')
end
end
end
end
context 'filtering by visibility' do context 'filtering by visibility' do
let_it_be(:snippets) do let_it_be(:snippets) do
[ [
......
...@@ -151,35 +151,4 @@ describe SnippetsHelper do ...@@ -151,35 +151,4 @@ describe SnippetsHelper do
"<input type=\"text\" readonly=\"readonly\" class=\"js-snippet-url-area snippet-embed-input form-control\" data-url=\"#{url}\" value=\"<script src=&quot;#{url}.js&quot;></script>\" autocomplete=\"off\"></input>" "<input type=\"text\" readonly=\"readonly\" class=\"js-snippet-url-area snippet-embed-input form-control\" data-url=\"#{url}\" value=\"<script src=&quot;#{url}.js&quot;></script>\" autocomplete=\"off\"></input>"
end end
end end
describe '#snippet_file_name' do
subject { helper.snippet_file_name(snippet) }
where(:snippet_type, :flag_enabled, :trait, :filename) do
[
[:personal_snippet, false, nil, 'foo.txt'],
[:personal_snippet, true, nil, 'foo.txt'],
[:personal_snippet, false, :repository, 'foo.txt'],
[:personal_snippet, true, :repository, '.gitattributes'],
[:project_snippet, false, nil, 'foo.txt'],
[:project_snippet, true, nil, 'foo.txt'],
[:project_snippet, false, :repository, 'foo.txt'],
[:project_snippet, true, :repository, '.gitattributes']
]
end
with_them do
let(:snippet) { create(snippet_type, trait, file_name: 'foo.txt') }
before do
allow(helper).to receive(:current_user).and_return(snippet.author)
stub_feature_flags(version_snippets: flag_enabled)
end
it 'returns the correct filename' do
expect(subject).to eq filename
end
end
end
end end
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