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
c7303b1a
Commit
c7303b1a
authored
May 17, 2021
by
Kerri Miller
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add default value for merge_requests_author_approval
Changelog: other
parent
cabd9d5a
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
43 additions
and
2 deletions
+43
-2
app/models/project.rb
app/models/project.rb
+4
-0
db/migrate/20210517221612_add_default_value_to_merge_requests_author_approval_on_projects.rb
...lt_value_to_merge_requests_author_approval_on_projects.rb
+17
-0
db/schema_migrations/20210517221612
db/schema_migrations/20210517221612
+1
-0
db/structure.sql
db/structure.sql
+1
-1
ee/spec/controllers/projects_controller_spec.rb
ee/spec/controllers/projects_controller_spec.rb
+4
-1
spec/models/project_spec.rb
spec/models/project_spec.rb
+16
-0
No files found.
app/models/project.rb
View file @
c7303b1a
...
...
@@ -2606,6 +2606,10 @@ class Project < ApplicationRecord
ProjectStatistics
.
increment_statistic
(
self
,
statistic
,
delta
)
end
def
merge_requests_author_approval
!!
read_attribute
(
:merge_requests_author_approval
)
end
private
def
set_container_registry_access_level
...
...
db/migrate/20210517221612_add_default_value_to_merge_requests_author_approval_on_projects.rb
0 → 100644
View file @
c7303b1a
# frozen_string_literal: true
class
AddDefaultValueToMergeRequestsAuthorApprovalOnProjects
<
ActiveRecord
::
Migration
[
6.0
]
include
Gitlab
::
Database
::
MigrationHelpers
def
up
with_lock_retries
do
change_column_default
:projects
,
:merge_requests_author_approval
,
false
end
end
def
down
with_lock_retries
do
change_column_default
:projects
,
:merge_requests_author_approval
,
nil
end
end
end
db/schema_migrations/20210517221612
0 → 100644
View file @
c7303b1a
69e7297ace1301bbdb63053bd30b75c326122873fbc6c5c15f9f118166111434
\ No newline at end of file
db/structure.sql
View file @
c7303b1a
...
...
@@ -16997,7 +16997,7 @@ CREATE TABLE projects (
pages_https_only boolean DEFAULT true,
external_webhook_token character varying,
packages_enabled boolean,
merge_requests_author_approval boolean,
merge_requests_author_approval boolean
DEFAULT false
,
pool_repository_id bigint,
runners_token_encrypted character varying,
bfg_object_map character varying,
ee/spec/controllers/projects_controller_spec.rb
View file @
c7303b1a
...
...
@@ -496,7 +496,7 @@ RSpec.describe ProjectsController do
project
.
reload
expect
(
project
[
setting
]).
to
eq
(
final_value
)
expect
(
project
[
setting
]).
to
eq
(
final_value
.
nil?
?
setting_default_value
:
final_value
)
end
end
end
...
...
@@ -505,6 +505,7 @@ RSpec.describe ProjectsController do
it_behaves_like
'merge request approvers rules'
do
let
(
:rule_name
)
{
:modify_approvers_rules
}
let
(
:setting
)
{
:disable_overriding_approvers_per_merge_request
}
let
(
:setting_default_value
)
{
nil
}
end
end
...
...
@@ -512,6 +513,7 @@ RSpec.describe ProjectsController do
it_behaves_like
'merge request approvers rules'
do
let
(
:rule_name
)
{
:modify_merge_request_author_setting
}
let
(
:setting
)
{
:merge_requests_author_approval
}
let
(
:setting_default_value
)
{
false
}
end
end
...
...
@@ -519,6 +521,7 @@ RSpec.describe ProjectsController do
it_behaves_like
'merge request approvers rules'
do
let
(
:rule_name
)
{
:modify_merge_request_committer_setting
}
let
(
:setting
)
{
:merge_requests_disable_committers_approval
}
let
(
:setting_default_value
)
{
nil
}
end
end
end
...
...
spec/models/project_spec.rb
View file @
c7303b1a
...
...
@@ -472,6 +472,22 @@ RSpec.describe Project, factory_default: :keep do
end
end
describe
'#merge_requests_author_approval'
do
where
(
:attribute_value
,
:return_value
)
do
true
|
true
false
|
false
nil
|
false
end
with_them
do
let
(
:project
)
{
create
(
:project
,
merge_requests_author_approval:
attribute_value
)
}
it
'returns expected value'
do
expect
(
project
.
merge_requests_author_approval
).
to
eq
(
return_value
)
end
end
end
describe
'#all_pipelines'
do
let_it_be
(
:project
)
{
create
(
:project
)
}
...
...
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