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
b9e1b9cf
Commit
b9e1b9cf
authored
May 11, 2020
by
Adam Hegyi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix insights notice text with YAML anchors
parent
5c3ddecc
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
26 additions
and
2 deletions
+26
-2
ee/changelogs/unreleased/fix-insights-note-bug.yml
ee/changelogs/unreleased/fix-insights-note-bug.yml
+5
-0
ee/lib/gitlab/insights/project_insights_config.rb
ee/lib/gitlab/insights/project_insights_config.rb
+6
-1
ee/spec/lib/gitlab/insights/project_insights_config_spec.rb
ee/spec/lib/gitlab/insights/project_insights_config_spec.rb
+15
-1
No files found.
ee/changelogs/unreleased/fix-insights-note-bug.yml
0 → 100644
View file @
b9e1b9cf
---
title
:
Fix incorrect notice text on insights page
merge_request
:
31570
author
:
type
:
fixed
ee/lib/gitlab/insights/project_insights_config.rb
View file @
b9e1b9cf
...
...
@@ -7,7 +7,7 @@ module Gitlab
def
initialize
(
project
:,
insights_config
:)
@project
=
project
@insights_config
=
insights_config
.
deep_dup
@insights_config
=
insights_config
_without_invalid_entries
(
insights_config
.
deep_dup
)
end
def
filtered_config
...
...
@@ -33,6 +33,11 @@ module Gitlab
def
includes_project?
(
project_ids_or_paths
)
project_ids_or_paths
.
any?
{
|
item
|
item
==
project
.
id
||
item
==
project
.
full_path
}
end
# filtering out leftover YAML anchor keys
def
insights_config_without_invalid_entries
(
config
)
config
.
reject
{
|
_
,
page_config
|
page_config
[
:title
].
nil?
&&
page_config
[
:charts
].
nil?
}
end
end
end
end
ee/spec/lib/gitlab/insights/project_insights_config_spec.rb
View file @
b9e1b9cf
...
...
@@ -30,6 +30,20 @@ describe Gitlab::Insights::ProjectInsightsConfig do
subject
{
described_class
.
new
(
project:
project
,
insights_config:
config
)
}
context
'filtering out invalid config entries'
do
let
(
:config_with_invalid_entry
)
{
config
.
merge
(
".projectOnly"
:
{
projects:
{
only:
[]
}
})
}
subject
{
described_class
.
new
(
project:
project
,
insights_config:
config_with_invalid_entry
)
}
it
'does not include invalid entry'
do
expect
(
subject
.
filtered_config
).
to
eq
(
config
)
end
it
'does not show notice text'
do
expect
(
subject
.
notice_text
).
to
eq
(
nil
)
end
end
context
'when no projects.only filter present'
do
it
'does not change the config'
do
expect
(
subject
.
filtered_config
).
to
eq
(
config
)
...
...
@@ -51,7 +65,7 @@ describe Gitlab::Insights::ProjectInsightsConfig do
expect
(
subject
.
filtered_config
[
:item1
][
:charts
]).
to
eq
([
chart1
])
end
it
'
has
notice text'
do
it
'
does not have a
notice text'
do
expect
(
subject
.
notice_text
).
not_to
eq
(
nil
)
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