Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
00bb0174
Commit
00bb0174
authored
Apr 20, 2020
by
Francisco Javier López
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove snippet file_name in snippet lists
This commit removes the snippet file_name from every snippet lists.
parent
6d8264b8
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
5 additions
and
87 deletions
+5
-87
app/helpers/snippets_helper.rb
app/helpers/snippets_helper.rb
+0
-10
app/views/shared/snippets/_snippet.html.haml
app/views/shared/snippets/_snippet.html.haml
+0
-5
changelogs/unreleased/fj-remove-file-name-in-snippet-lists.yml
...elogs/unreleased/fj-remove-file-name-in-snippet-lists.yml
+5
-0
spec/features/dashboard/snippets_spec.rb
spec/features/dashboard/snippets_spec.rb
+0
-41
spec/helpers/snippets_helper_spec.rb
spec/helpers/snippets_helper_spec.rb
+0
-31
No files found.
app/helpers/snippets_helper.rb
View file @
00bb0174
...
...
@@ -160,14 +160,4 @@ module SnippetsHelper
title:
'Download'
,
rel:
'noopener noreferrer'
)
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
app/views/shared/snippets/_snippet.html.haml
View file @
00bb0174
-
link_project
=
local_assigns
.
fetch
(
:link_project
,
false
)
-
notes_count
=
@noteable_meta_data
[
snippet
.
id
].
user_notes_count
-
file_name
=
snippet_file_name
(
snippet
)
%li
.snippet-row.py-3
=
image_tag
avatar_icon_for_user
(
snippet
.
author
),
class:
"avatar s40 d-none d-sm-block"
,
alt:
''
...
...
@@ -8,10 +7,6 @@
.title
=
link_to
gitlab_snippet_path
(
snippet
)
do
=
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
%li
...
...
changelogs/unreleased/fj-remove-file-name-in-snippet-lists.yml
0 → 100644
View file @
00bb0174
---
title
:
Remove snippet file_name from snippet lists
merge_request
:
29937
author
:
type
:
changed
spec/features/dashboard/snippets_spec.rb
View file @
00bb0174
...
...
@@ -49,47 +49,6 @@ describe 'Dashboard snippets' do
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
let_it_be
(
:snippets
)
do
[
...
...
spec/helpers/snippets_helper_spec.rb
View file @
00bb0174
...
...
@@ -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="
#{
url
}
.js"></script>
\"
autocomplete=
\"
off
\"
></input>"
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
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment