Skip to content
GitLab
Next
Menu
Why GitLab
Pricing
Contact Sales
Explore
Why GitLab
Pricing
Contact Sales
Explore
Sign in
Get free trial
Primary navigation
Search or go to…
Project
GitLab
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Privacy statement
Keyboard shortcuts
?
What's new
4
Snippets
Groups
Projects
Show more breadcrumbs
GitLab.org
GitLab
Commits
f4f94f04
Commit
f4f94f04
authored
4 months ago
by
Gosia Ksionek
Browse files
Options
Downloads
Patches
Plain Diff
Add param filtering to avoid error while saving project settings
parent
4b62462f
No related branches found
Branches containing commit
No related tags found
2 merge requests
!171369
Add param filtering to avoid error while saving project settings
,
!171309
Draft: Fetch issues / MRs / epics count in the sidebar with GraphQL
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
ee/app/controllers/ee/projects_controller.rb
+4
-1
4 additions, 1 deletion
ee/app/controllers/ee/projects_controller.rb
ee/spec/controllers/projects_controller_spec.rb
+40
-17
40 additions, 17 deletions
ee/spec/controllers/projects_controller_spec.rb
with
44 additions
and
18 deletions
ee/app/controllers/ee/projects_controller.rb
+
4
−
1
View file @
f4f94f04
...
...
@@ -92,7 +92,6 @@ def project_setting_attributes
attributes
=
%i[
prevent_merge_without_jira_issue
cve_id_request_enabled
duo_features_enabled
product_analytics_data_collector_host
cube_api_base_url
cube_api_key
...
...
@@ -107,6 +106,10 @@ def project_setting_attributes
attributes
<<
:spp_repository_pipeline_access
end
unless
project
&
.
project_setting
&
.
duo_features_enabled_locked?
attributes
<<
:duo_features_enabled
end
super
+
attributes
end
...
...
This diff is collapsed.
Click to expand it.
ee/spec/controllers/projects_controller_spec.rb
+
40
−
17
View file @
f4f94f04
...
...
@@ -6,7 +6,7 @@
let_it_be
(
:user
)
{
create
(
:user
)
}
let_it_be
(
:group
)
{
create
(
:group
)
}
let_it_be
(
:project
,
reload:
true
)
{
create
(
:project
)
}
let_it_be
(
:project
,
reload:
true
)
{
create
(
:project
,
namespace:
group
)
}
let_it_be
(
:public_project
)
{
create
(
:project
,
:public
,
:repository
,
namespace:
group
)
}
...
...
@@ -391,24 +391,47 @@
expect
(
project
.
project_setting
.
cve_id_request_enabled
).
to
eq
(
true
)
end
it
'updates duo_features_enabled'
do
project
.
project_setting
.
duo_features_enabled
=
false
project
.
project_setting
.
save!
context
'when enabling duo features'
do
let
(
:params
)
{
{
project_setting_attributes:
{
duo_features_enabled:
true
}
}
}
params
=
{
project_setting_attributes:
{
duo_features_enabled:
true
}
}
put
:update
,
params:
{
namespace_id:
project
.
namespace
,
id:
project
,
project:
params
}
project
.
reload
let
(
:request
)
do
put
:update
,
params:
{
namespace_id:
project
.
namespace
,
id:
project
,
project:
params
}
end
it
'updates duo_features_enabled'
do
project
.
project_setting
.
duo_features_enabled
=
false
project
.
project_setting
.
save!
expect
(
project
.
project_setting
.
duo_features_enabled
).
to
eq
(
true
)
request
expect
(
project
.
reload
.
project_setting
.
duo_features_enabled
).
to
eq
(
true
)
end
context
'when duo features are locked by the ancestor'
do
before
do
project
.
project_setting
.
duo_features_enabled
=
false
project
.
project_setting
.
save!
project
.
namespace
.
namespace_settings
.
lock_duo_features_enabled
=
true
project
.
namespace
.
namespace_settings
.
duo_features_enabled
=
false
project
.
namespace
.
namespace_settings
.
save!
end
it
'does not update duo feature'
do
expect
{
request
}.
not_to
change
{
project
.
reload
.
project_setting
.
duo_features_enabled
}.
from
(
false
)
end
context
'with more params passed'
do
let
(
:params
)
do
{
project_setting_attributes:
{
duo_features_enabled:
true
},
description:
'Settings test'
}
end
it
'does not update duo feature, but updates other attributes'
do
expect
{
request
}.
not_to
change
{
project
.
reload
.
project_setting
.
duo_features_enabled
}.
from
(
false
)
expect
(
project
.
description
).
to
eq
(
'Settings test'
)
end
end
end
end
context
'when merge_pipelines_enabled param is specified'
do
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment