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
0
Merge Requests
0
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
Léo-Paul Géneau
gitlab-ce
Commits
a3f76b76
Commit
a3f76b76
authored
Sep 01, 2017
by
Ashley Dumaine
Committed by
Sean McGivern
Sep 06, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
change collapse to resolve and comments to discussions
parent
959e6d22
Changes
19
Hide whitespace changes
Inline
Side-by-side
Showing
19 changed files
with
85 additions
and
83 deletions
+85
-83
app/controllers/projects_controller.rb
app/controllers/projects_controller.rb
+1
-1
app/models/diff_discussion.rb
app/models/diff_discussion.rb
+0
-8
app/models/project.rb
app/models/project.rb
+1
-1
app/views/discussions/_headline.html.haml
app/views/discussions/_headline.html.haml
+15
-6
app/views/projects/_merge_request_merge_settings.html.haml
app/views/projects/_merge_request_merge_settings.html.haml
+4
-4
changelogs/unreleased/36994-toggle-for-automatically-collapsing-outdated-diff-comments.yml
...e-for-automatically-collapsing-outdated-diff-comments.yml
+1
-2
db/migrate/20170825154015_resolve_outdated_diff_discussions.rb
...grate/20170825154015_resolve_outdated_diff_discussions.rb
+2
-3
db/schema.rb
db/schema.rb
+1
-1
doc/api/projects.md
doc/api/projects.md
+12
-12
doc/user/discussions/img/automatically_collapse_outdated_diff_comments_regardless_of_discussion_resolution.png
...ted_diff_comments_regardless_of_discussion_resolution.png
+0
-0
doc/user/discussions/img/automatically_resolve_outdated_diff_discussions.png
...s/img/automatically_resolve_outdated_diff_discussions.png
+0
-0
doc/user/discussions/index.md
doc/user/discussions/index.md
+5
-6
lib/api/entities.rb
lib/api/entities.rb
+1
-1
lib/api/projects.rb
lib/api/projects.rb
+2
-2
lib/api/v3/entities.rb
lib/api/v3/entities.rb
+1
-1
lib/api/v3/projects.rb
lib/api/v3/projects.rb
+2
-2
spec/features/merge_requests/resolve_outdated_diff_discussions.rb
...tures/merge_requests/resolve_outdated_diff_discussions.rb
+9
-5
spec/requests/api/projects_spec.rb
spec/requests/api/projects_spec.rb
+14
-14
spec/requests/api/v3/projects_spec.rb
spec/requests/api/v3/projects_spec.rb
+14
-14
No files found.
app/controllers/projects_controller.rb
View file @
a3f76b76
...
@@ -323,7 +323,7 @@ class ProjectsController < Projects::ApplicationController
...
@@ -323,7 +323,7 @@ class ProjectsController < Projects::ApplicationController
:build_allow_git_fetch
,
:build_allow_git_fetch
,
:build_coverage_regex
,
:build_coverage_regex
,
:build_timeout_in_minutes
,
:build_timeout_in_minutes
,
:
collapse_outdated_diff_comment
s
,
:
resolve_outdated_diff_discussion
s
,
:container_registry_enabled
,
:container_registry_enabled
,
:default_branch
,
:default_branch
,
:description
,
:description
,
...
...
app/models/diff_discussion.rb
View file @
a3f76b76
...
@@ -18,14 +18,6 @@ class DiffDiscussion < Discussion
...
@@ -18,14 +18,6 @@ class DiffDiscussion < Discussion
false
false
end
end
def
collapsed?
resolved?
||
(
project
.
collapse_outdated_diff_comments
&&
!
active?
)
end
def
expanded?
!
collapsed?
end
def
merge_request_version_params
def
merge_request_version_params
return
unless
for_merge_request?
return
unless
for_merge_request?
return
{}
if
active?
return
{}
if
active?
...
...
app/models/project.rb
View file @
a3f76b76
...
@@ -37,7 +37,7 @@ class Project < ActiveRecord::Base
...
@@ -37,7 +37,7 @@ class Project < ActiveRecord::Base
default_value_for
:archived
,
false
default_value_for
:archived
,
false
default_value_for
:visibility_level
,
gitlab_config_features
.
visibility_level
default_value_for
:visibility_level
,
gitlab_config_features
.
visibility_level
default_value_for
:
collapse_outdated_diff_comment
s
,
false
default_value_for
:
resolve_outdated_diff_discussion
s
,
false
default_value_for
:container_registry_enabled
,
gitlab_config_features
.
container_registry
default_value_for
:container_registry_enabled
,
gitlab_config_features
.
container_registry
default_value_for
(
:repository_storage
)
{
current_application_settings
.
pick_repository_storage
}
default_value_for
(
:repository_storage
)
{
current_application_settings
.
pick_repository_storage
}
default_value_for
(
:shared_runners_enabled
)
{
current_application_settings
.
shared_runners_enabled
}
default_value_for
(
:shared_runners_enabled
)
{
current_application_settings
.
shared_runners_enabled
}
...
...
app/views/discussions/_headline.html.haml
View file @
a3f76b76
-
if
discussion
.
resolved?
-
if
discussion
.
resolved?
.discussion-headline-light.js-discussion-headline
-
if
project
.
resolve_outdated_diff_discussions
Resolved
.discussion-headline-light.js-discussion-headline
-
if
discussion
.
resolved_by
Automatically resolved
by
-
if
discussion
.
resolved_by
=
link_to_member
(
@project
,
discussion
.
resolved_by
,
avatar:
false
)
by
=
time_ago_with_tooltip
(
discussion
.
resolved_at
,
placement:
"bottom"
)
=
link_to_member
(
@project
,
discussion
.
resolved_by
,
avatar:
false
)
with a push
=
time_ago_with_tooltip
(
discussion
.
resolved_at
,
placement:
"bottom"
)
-
else
.discussion-headline-light.js-discussion-headline
Resolved
-
if
discussion
.
resolved_by
by
=
link_to_member
(
@project
,
discussion
.
resolved_by
,
avatar:
false
)
=
time_ago_with_tooltip
(
discussion
.
resolved_at
,
placement:
"bottom"
)
-
elsif
discussion
.
updated?
-
elsif
discussion
.
updated?
.discussion-headline-light.js-discussion-headline
.discussion-headline-light.js-discussion-headline
Last updated
Last updated
...
...
app/views/projects/_merge_request_merge_settings.html.haml
View file @
a3f76b76
...
@@ -13,11 +13,11 @@
...
@@ -13,11 +13,11 @@
=
form
.
label
:only_allow_merge_if_all_discussions_are_resolved
do
=
form
.
label
:only_allow_merge_if_all_discussions_are_resolved
do
=
form
.
check_box
:only_allow_merge_if_all_discussions_are_resolved
=
form
.
check_box
:only_allow_merge_if_all_discussions_are_resolved
%strong
Only allow merge requests to be merged if all discussions are resolved
%strong
Only allow merge requests to be merged if all discussions are resolved
.checkbox
=
form
.
label
:resolve_outdated_diff_discussions
do
=
form
.
check_box
:resolve_outdated_diff_discussions
%strong
Automatically resolve merge request diffs discussions on lines changed with a push
.checkbox
.checkbox
=
form
.
label
:printing_merge_request_link_enabled
do
=
form
.
label
:printing_merge_request_link_enabled
do
=
form
.
check_box
:printing_merge_request_link_enabled
=
form
.
check_box
:printing_merge_request_link_enabled
%strong
Show link to create/view merge request when pushing from the command line
%strong
Show link to create/view merge request when pushing from the command line
.checkbox
=
form
.
label
:collapse_outdated_diff_comments
do
=
form
.
check_box
:collapse_outdated_diff_comments
%strong
Collapse outdated diffs regardless of discussion resolution
changelogs/unreleased/36994-toggle-for-automatically-collapsing-outdated-diff-comments.yml
View file @
a3f76b76
---
---
title
:
Add repository toggle for automatically collapsing outdated diff comments regardless
title
:
Add repository toggle for automatically resolving outdated diff discussions
of discussion resolution
merge_request
:
merge_request
:
author
:
author
:
type
:
added
type
:
added
db/migrate/20170825154015_
collapse_outdated_diff_comment
s.rb
→
db/migrate/20170825154015_
resolve_outdated_diff_discussion
s.rb
View file @
a3f76b76
# rubocop:disable Migration/AddColumnWithDefaultToLargeTable
class
CollapseOutdatedDiffComments
<
ActiveRecord
::
Migration
class
CollapseOutdatedDiffComments
<
ActiveRecord
::
Migration
include
Gitlab
::
Database
::
MigrationHelpers
include
Gitlab
::
Database
::
MigrationHelpers
...
@@ -7,12 +6,12 @@ class CollapseOutdatedDiffComments < ActiveRecord::Migration
...
@@ -7,12 +6,12 @@ class CollapseOutdatedDiffComments < ActiveRecord::Migration
def
up
def
up
add_column_with_default
(
:projects
,
add_column_with_default
(
:projects
,
:
collapse_outdated_diff_comment
s
,
:
resolve_outdated_diff_discussion
s
,
:boolean
,
:boolean
,
default:
false
)
default:
false
)
end
end
def
down
def
down
remove_column
(
:projects
,
:
collapse_outdated_diff_comment
s
)
remove_column
(
:projects
,
:
resolve_outdated_diff_discussion
s
)
end
end
end
end
db/schema.rb
View file @
a3f76b76
...
@@ -1202,7 +1202,7 @@ ActiveRecord::Schema.define(version: 20170901071411) do
...
@@ -1202,7 +1202,7 @@ ActiveRecord::Schema.define(version: 20170901071411) do
t
.
boolean
"public_builds"
,
default:
true
,
null:
false
t
.
boolean
"public_builds"
,
default:
true
,
null:
false
t
.
boolean
"last_repository_check_failed"
t
.
boolean
"last_repository_check_failed"
t
.
datetime
"last_repository_check_at"
t
.
datetime
"last_repository_check_at"
t
.
boolean
"
collapse_outdated_diff_comment
s"
,
default:
false
,
null:
false
t
.
boolean
"
resolve_outdated_diff_discussion
s"
,
default:
false
,
null:
false
t
.
boolean
"container_registry_enabled"
t
.
boolean
"container_registry_enabled"
t
.
boolean
"only_allow_merge_if_pipeline_succeeds"
,
default:
false
,
null:
false
t
.
boolean
"only_allow_merge_if_pipeline_succeeds"
,
default:
false
,
null:
false
t
.
boolean
"has_external_issue_tracker"
t
.
boolean
"has_external_issue_tracker"
...
...
doc/api/projects.md
View file @
a3f76b76
...
@@ -70,7 +70,7 @@ Parameters:
...
@@ -70,7 +70,7 @@ Parameters:
"jobs_enabled"
:
true
,
"jobs_enabled"
:
true
,
"wiki_enabled"
:
true
,
"wiki_enabled"
:
true
,
"snippets_enabled"
:
false
,
"snippets_enabled"
:
false
,
"
collapse_outdated_diff_comment
s"
:
false
,
"
resolve_outdated_diff_discussion
s"
:
false
,
"container_registry_enabled"
:
false
,
"container_registry_enabled"
:
false
,
"created_at"
:
"2013-09-30T13:46:02Z"
,
"created_at"
:
"2013-09-30T13:46:02Z"
,
"last_activity_at"
:
"2013-09-30T13:46:02Z"
,
"last_activity_at"
:
"2013-09-30T13:46:02Z"
,
...
@@ -138,7 +138,7 @@ Parameters:
...
@@ -138,7 +138,7 @@ Parameters:
"jobs_enabled"
:
true
,
"jobs_enabled"
:
true
,
"wiki_enabled"
:
true
,
"wiki_enabled"
:
true
,
"snippets_enabled"
:
false
,
"snippets_enabled"
:
false
,
"
collapse_outdated_diff_comment
s"
:
false
,
"
resolve_outdated_diff_discussion
s"
:
false
,
"container_registry_enabled"
:
false
,
"container_registry_enabled"
:
false
,
"created_at"
:
"2013-09-30T13:46:02Z"
,
"created_at"
:
"2013-09-30T13:46:02Z"
,
"last_activity_at"
:
"2013-09-30T13:46:02Z"
,
"last_activity_at"
:
"2013-09-30T13:46:02Z"
,
...
@@ -248,7 +248,7 @@ Parameters:
...
@@ -248,7 +248,7 @@ Parameters:
"jobs_enabled"
:
true
,
"jobs_enabled"
:
true
,
"wiki_enabled"
:
true
,
"wiki_enabled"
:
true
,
"snippets_enabled"
:
false
,
"snippets_enabled"
:
false
,
"
collapse_outdated_diff_comment
s"
:
false
,
"
resolve_outdated_diff_discussion
s"
:
false
,
"container_registry_enabled"
:
false
,
"container_registry_enabled"
:
false
,
"created_at"
:
"2013-09-30T13:46:02Z"
,
"created_at"
:
"2013-09-30T13:46:02Z"
,
"last_activity_at"
:
"2013-09-30T13:46:02Z"
,
"last_activity_at"
:
"2013-09-30T13:46:02Z"
,
...
@@ -316,7 +316,7 @@ Parameters:
...
@@ -316,7 +316,7 @@ Parameters:
"jobs_enabled"
:
true
,
"jobs_enabled"
:
true
,
"wiki_enabled"
:
true
,
"wiki_enabled"
:
true
,
"snippets_enabled"
:
false
,
"snippets_enabled"
:
false
,
"
collapse_outdated_diff_comment
s"
:
false
,
"
resolve_outdated_diff_discussion
s"
:
false
,
"container_registry_enabled"
:
false
,
"container_registry_enabled"
:
false
,
"created_at"
:
"2013-09-30T13:46:02Z"
,
"created_at"
:
"2013-09-30T13:46:02Z"
,
"last_activity_at"
:
"2013-09-30T13:46:02Z"
,
"last_activity_at"
:
"2013-09-30T13:46:02Z"
,
...
@@ -415,7 +415,7 @@ Parameters:
...
@@ -415,7 +415,7 @@ Parameters:
"jobs_enabled"
:
true
,
"jobs_enabled"
:
true
,
"wiki_enabled"
:
true
,
"wiki_enabled"
:
true
,
"snippets_enabled"
:
false
,
"snippets_enabled"
:
false
,
"
collapse_outdated_diff_comment
s"
:
false
,
"
resolve_outdated_diff_discussion
s"
:
false
,
"container_registry_enabled"
:
false
,
"container_registry_enabled"
:
false
,
"created_at"
:
"2013-09-30T13:46:02Z"
,
"created_at"
:
"2013-09-30T13:46:02Z"
,
"last_activity_at"
:
"2013-09-30T13:46:02Z"
,
"last_activity_at"
:
"2013-09-30T13:46:02Z"
,
...
@@ -542,7 +542,7 @@ Parameters:
...
@@ -542,7 +542,7 @@ Parameters:
|
`jobs_enabled`
| boolean | no | Enable jobs for this project |
|
`jobs_enabled`
| boolean | no | Enable jobs for this project |
|
`wiki_enabled`
| boolean | no | Enable wiki for this project |
|
`wiki_enabled`
| boolean | no | Enable wiki for this project |
|
`snippets_enabled`
| boolean | no | Enable snippets for this project |
|
`snippets_enabled`
| boolean | no | Enable snippets for this project |
|
`
collapse_outdated_diff_comments`
| boolean | no | Collapse outdated diffs regardless of discussion resolution
|
|
`
resolve_outdated_diff_discussions`
| boolean | no | Automatically resolve merge request diffs discussions on lines changed with a push
|
|
`container_registry_enabled`
| boolean | no | Enable container registry for this project |
|
`container_registry_enabled`
| boolean | no | Enable container registry for this project |
|
`shared_runners_enabled`
| boolean | no | Enable shared runners for this project |
|
`shared_runners_enabled`
| boolean | no | Enable shared runners for this project |
|
`visibility`
| string | no | See
[
project visibility level
](
#project-visibility-level
)
|
|
`visibility`
| string | no | See
[
project visibility level
](
#project-visibility-level
)
|
...
@@ -580,7 +580,7 @@ Parameters:
...
@@ -580,7 +580,7 @@ Parameters:
|
`jobs_enabled`
| boolean | no | Enable jobs for this project |
|
`jobs_enabled`
| boolean | no | Enable jobs for this project |
|
`wiki_enabled`
| boolean | no | Enable wiki for this project |
|
`wiki_enabled`
| boolean | no | Enable wiki for this project |
|
`snippets_enabled`
| boolean | no | Enable snippets for this project |
|
`snippets_enabled`
| boolean | no | Enable snippets for this project |
|
`
collapse_outdated_diff_comments`
| boolean | no | Collapse outdated diffs regardless of discussion resolution
|
|
`
resolve_outdated_diff_discussions`
| boolean | no | Automatically resolve merge request diffs discussions on lines changed with a push
|
|
`container_registry_enabled`
| boolean | no | Enable container registry for this project |
|
`container_registry_enabled`
| boolean | no | Enable container registry for this project |
|
`shared_runners_enabled`
| boolean | no | Enable shared runners for this project |
|
`shared_runners_enabled`
| boolean | no | Enable shared runners for this project |
|
`visibility`
| string | no | See
[
project visibility level
](
#project-visibility-level
)
|
|
`visibility`
| string | no | See
[
project visibility level
](
#project-visibility-level
)
|
...
@@ -617,7 +617,7 @@ Parameters:
...
@@ -617,7 +617,7 @@ Parameters:
|
`jobs_enabled`
| boolean | no | Enable jobs for this project |
|
`jobs_enabled`
| boolean | no | Enable jobs for this project |
|
`wiki_enabled`
| boolean | no | Enable wiki for this project |
|
`wiki_enabled`
| boolean | no | Enable wiki for this project |
|
`snippets_enabled`
| boolean | no | Enable snippets for this project |
|
`snippets_enabled`
| boolean | no | Enable snippets for this project |
|
`
collapse_outdated_diff_comments`
| boolean | no | Collapse outdated diffs regardless of discussion resolution
|
|
`
resolve_outdated_diff_discussions`
| boolean | no | Automatically resolve merge request diffs discussions on lines changed with a push
|
|
`container_registry_enabled`
| boolean | no | Enable container registry for this project |
|
`container_registry_enabled`
| boolean | no | Enable container registry for this project |
|
`shared_runners_enabled`
| boolean | no | Enable shared runners for this project |
|
`shared_runners_enabled`
| boolean | no | Enable shared runners for this project |
|
`visibility`
| string | no | See
[
project visibility level
](
#project-visibility-level
)
|
|
`visibility`
| string | no | See
[
project visibility level
](
#project-visibility-level
)
|
...
@@ -691,7 +691,7 @@ Example response:
...
@@ -691,7 +691,7 @@ Example response:
"jobs_enabled"
:
true
,
"jobs_enabled"
:
true
,
"wiki_enabled"
:
true
,
"wiki_enabled"
:
true
,
"snippets_enabled"
:
false
,
"snippets_enabled"
:
false
,
"
collapse_outdated_diff_comment
s"
:
false
,
"
resolve_outdated_diff_discussion
s"
:
false
,
"container_registry_enabled"
:
false
,
"container_registry_enabled"
:
false
,
"created_at"
:
"2013-09-30T13:46:02Z"
,
"created_at"
:
"2013-09-30T13:46:02Z"
,
"last_activity_at"
:
"2013-09-30T13:46:02Z"
,
"last_activity_at"
:
"2013-09-30T13:46:02Z"
,
...
@@ -767,7 +767,7 @@ Example response:
...
@@ -767,7 +767,7 @@ Example response:
"jobs_enabled"
:
true
,
"jobs_enabled"
:
true
,
"wiki_enabled"
:
true
,
"wiki_enabled"
:
true
,
"snippets_enabled"
:
false
,
"snippets_enabled"
:
false
,
"
collapse_outdated_diff_comment
s"
:
false
,
"
resolve_outdated_diff_discussion
s"
:
false
,
"container_registry_enabled"
:
false
,
"container_registry_enabled"
:
false
,
"created_at"
:
"2013-09-30T13:46:02Z"
,
"created_at"
:
"2013-09-30T13:46:02Z"
,
"last_activity_at"
:
"2013-09-30T13:46:02Z"
,
"last_activity_at"
:
"2013-09-30T13:46:02Z"
,
...
@@ -849,7 +849,7 @@ Example response:
...
@@ -849,7 +849,7 @@ Example response:
"jobs_enabled"
:
true
,
"jobs_enabled"
:
true
,
"wiki_enabled"
:
true
,
"wiki_enabled"
:
true
,
"snippets_enabled"
:
false
,
"snippets_enabled"
:
false
,
"
collapse_outdated_diff_comment
s"
:
false
,
"
resolve_outdated_diff_discussion
s"
:
false
,
"container_registry_enabled"
:
false
,
"container_registry_enabled"
:
false
,
"created_at"
:
"2013-09-30T13:46:02Z"
,
"created_at"
:
"2013-09-30T13:46:02Z"
,
"last_activity_at"
:
"2013-09-30T13:46:02Z"
,
"last_activity_at"
:
"2013-09-30T13:46:02Z"
,
...
@@ -943,7 +943,7 @@ Example response:
...
@@ -943,7 +943,7 @@ Example response:
"jobs_enabled"
:
true
,
"jobs_enabled"
:
true
,
"wiki_enabled"
:
true
,
"wiki_enabled"
:
true
,
"snippets_enabled"
:
false
,
"snippets_enabled"
:
false
,
"
collapse_outdated_diff_comment
s"
:
false
,
"
resolve_outdated_diff_discussion
s"
:
false
,
"container_registry_enabled"
:
false
,
"container_registry_enabled"
:
false
,
"created_at"
:
"2013-09-30T13:46:02Z"
,
"created_at"
:
"2013-09-30T13:46:02Z"
,
"last_activity_at"
:
"2013-09-30T13:46:02Z"
,
"last_activity_at"
:
"2013-09-30T13:46:02Z"
,
...
...
doc/user/discussions/img/automatically_collapse_outdated_diff_comments_regardless_of_discussion_resolution.png
deleted
100644 → 0
View file @
959e6d22
127 KB
doc/user/discussions/img/automatically_resolve_outdated_diff_discussions.png
0 → 100644
View file @
a3f76b76
105 KB
doc/user/discussions/index.md
View file @
a3f76b76
...
@@ -116,18 +116,17 @@ are resolved.
...
@@ -116,18 +116,17 @@ are resolved.
![
Only allow merge if all the discussions are resolved message
](
img/only_allow_merge_if_all_discussions_are_resolved_msg.png
)
![
Only allow merge if all the discussions are resolved message
](
img/only_allow_merge_if_all_discussions_are_resolved_msg.png
)
### Automatically
collapse outdated diff comments regardless of discussion resolution
### Automatically
resolve merge request diffs discussions on lines changed with a push
You can automatically collapse comments on outdated diffs regardless of whether
You can automatically resolve merge request diff discussions on lines modified with a new commit.
the discussion is resolved.
Navigate to your project's settings page, select the
Navigate to your project's settings page, select the
**
Collapse outdated diffs regardless of discussion resolution
**
check box and hit
**
Automatically resolve merge request diffs discussions on lines changed with a push
**
check box and hit
**Save**
for the changes to take effect.
**Save**
for the changes to take effect.
![
Automatically
collapse outdated diff comments regardless of discussion resolution
](
img/automatically_collapse_outdated_diff_comments_regardless_of_discussion_resolution
.png
)
![
Automatically
resolve merge request diffs discussions on lines changed with a push
](
img/automatically_resolve_outdated_diff_discussions
.png
)
From now on, any discussions on an outdated diff will be
collaps
ed by default.
From now on, any discussions on an outdated diff will be
resolv
ed by default.
## Threaded discussions
## Threaded discussions
...
...
lib/api/entities.rb
View file @
a3f76b76
...
@@ -119,7 +119,7 @@ module API
...
@@ -119,7 +119,7 @@ module API
expose
:archived?
,
as: :archived
expose
:archived?
,
as: :archived
expose
:visibility
expose
:visibility
expose
:owner
,
using:
Entities
::
UserBasic
,
unless:
->
(
project
,
options
)
{
project
.
group
}
expose
:owner
,
using:
Entities
::
UserBasic
,
unless:
->
(
project
,
options
)
{
project
.
group
}
expose
:
collapse_outdated_diff_comment
s
expose
:
resolve_outdated_diff_discussion
s
expose
:container_registry_enabled
expose
:container_registry_enabled
# Expose old field names with the new permissions methods to keep API compatible
# Expose old field names with the new permissions methods to keep API compatible
...
...
lib/api/projects.rb
View file @
a3f76b76
...
@@ -16,7 +16,7 @@ module API
...
@@ -16,7 +16,7 @@ module API
optional
:jobs_enabled
,
type:
Boolean
,
desc:
'Flag indication if jobs are enabled'
optional
:jobs_enabled
,
type:
Boolean
,
desc:
'Flag indication if jobs are enabled'
optional
:snippets_enabled
,
type:
Boolean
,
desc:
'Flag indication if snippets are enabled'
optional
:snippets_enabled
,
type:
Boolean
,
desc:
'Flag indication if snippets are enabled'
optional
:shared_runners_enabled
,
type:
Boolean
,
desc:
'Flag indication if shared runners are enabled for that project'
optional
:shared_runners_enabled
,
type:
Boolean
,
desc:
'Flag indication if shared runners are enabled for that project'
optional
:
collapse_outdated_diff_comments
,
type:
Boolean
,
desc:
'Collapse outdated diffs regardless of discussion resolution
'
optional
:
resolve_outdated_diff_discussions
,
type:
Boolean
,
desc:
'Automatically resolve merge request diffs discussions on lines changed with a push
'
optional
:container_registry_enabled
,
type:
Boolean
,
desc:
'Flag indication if the container registry is enabled for that project'
optional
:container_registry_enabled
,
type:
Boolean
,
desc:
'Flag indication if the container registry is enabled for that project'
optional
:lfs_enabled
,
type:
Boolean
,
desc:
'Flag indication if Git LFS is enabled for that project'
optional
:lfs_enabled
,
type:
Boolean
,
desc:
'Flag indication if Git LFS is enabled for that project'
optional
:visibility
,
type:
String
,
values:
Gitlab
::
VisibilityLevel
.
string_values
,
desc:
'The visibility of the project.'
optional
:visibility
,
type:
String
,
values:
Gitlab
::
VisibilityLevel
.
string_values
,
desc:
'The visibility of the project.'
...
@@ -237,7 +237,7 @@ module API
...
@@ -237,7 +237,7 @@ module API
at_least_one_of_ce
=
at_least_one_of_ce
=
[
[
:jobs_enabled
,
:jobs_enabled
,
:
collapse_outdated_diff_comment
s
,
:
resolve_outdated_diff_discussion
s
,
:container_registry_enabled
,
:container_registry_enabled
,
:default_branch
,
:default_branch
,
:description
,
:description
,
...
...
lib/api/v3/entities.rb
View file @
a3f76b76
...
@@ -64,7 +64,7 @@ module API
...
@@ -64,7 +64,7 @@ module API
expose
:owner
,
using:
::
API
::
Entities
::
UserBasic
,
unless:
->
(
project
,
options
)
{
project
.
group
}
expose
:owner
,
using:
::
API
::
Entities
::
UserBasic
,
unless:
->
(
project
,
options
)
{
project
.
group
}
expose
:name
,
:name_with_namespace
expose
:name
,
:name_with_namespace
expose
:path
,
:path_with_namespace
expose
:path
,
:path_with_namespace
expose
:
collapse_outdated_diff_comment
s
expose
:
resolve_outdated_diff_discussion
s
expose
:container_registry_enabled
expose
:container_registry_enabled
# Expose old field names with the new permissions methods to keep API compatible
# Expose old field names with the new permissions methods to keep API compatible
...
...
lib/api/v3/projects.rb
View file @
a3f76b76
...
@@ -18,7 +18,7 @@ module API
...
@@ -18,7 +18,7 @@ module API
optional
:builds_enabled
,
type:
Boolean
,
desc:
'Flag indication if builds are enabled'
optional
:builds_enabled
,
type:
Boolean
,
desc:
'Flag indication if builds are enabled'
optional
:snippets_enabled
,
type:
Boolean
,
desc:
'Flag indication if snippets are enabled'
optional
:snippets_enabled
,
type:
Boolean
,
desc:
'Flag indication if snippets are enabled'
optional
:shared_runners_enabled
,
type:
Boolean
,
desc:
'Flag indication if shared runners are enabled for that project'
optional
:shared_runners_enabled
,
type:
Boolean
,
desc:
'Flag indication if shared runners are enabled for that project'
optional
:
collapse_outdated_diff_comments
,
type:
Boolean
,
desc:
'Collapse outdated diffs regardless of discussion resolution
'
optional
:
resolve_outdated_diff_discussions
,
type:
Boolean
,
desc:
'Automatically resolve merge request diffs discussions on lines changed with a push
'
optional
:container_registry_enabled
,
type:
Boolean
,
desc:
'Flag indication if the container registry is enabled for that project'
optional
:container_registry_enabled
,
type:
Boolean
,
desc:
'Flag indication if the container registry is enabled for that project'
optional
:lfs_enabled
,
type:
Boolean
,
desc:
'Flag indication if Git LFS is enabled for that project'
optional
:lfs_enabled
,
type:
Boolean
,
desc:
'Flag indication if Git LFS is enabled for that project'
optional
:public
,
type:
Boolean
,
desc:
'Create a public project. The same as visibility_level = 20.'
optional
:public
,
type:
Boolean
,
desc:
'Create a public project. The same as visibility_level = 20.'
...
@@ -297,7 +297,7 @@ module API
...
@@ -297,7 +297,7 @@ module API
use
:optional_params
use
:optional_params
at_least_one_of
:name
,
:description
,
:issues_enabled
,
:merge_requests_enabled
,
at_least_one_of
:name
,
:description
,
:issues_enabled
,
:merge_requests_enabled
,
:wiki_enabled
,
:builds_enabled
,
:snippets_enabled
,
:wiki_enabled
,
:builds_enabled
,
:snippets_enabled
,
:shared_runners_enabled
,
:
collapse_outdated_diff_comment
s
,
:shared_runners_enabled
,
:
resolve_outdated_diff_discussion
s
,
:container_registry_enabled
,
:lfs_enabled
,
:public
,
:visibility_level
,
:container_registry_enabled
,
:lfs_enabled
,
:public
,
:visibility_level
,
:public_builds
,
:request_access_enabled
,
:only_allow_merge_if_build_succeeds
,
:public_builds
,
:request_access_enabled
,
:only_allow_merge_if_build_succeeds
,
:only_allow_merge_if_all_discussions_are_resolved
,
:path
,
:only_allow_merge_if_all_discussions_are_resolved
,
:path
,
...
...
spec/features/merge_requests/
collapse_outdated_diff_comment
s.rb
→
spec/features/merge_requests/
resolve_outdated_diff_discussion
s.rb
View file @
a3f76b76
require
'spec_helper'
require
'spec_helper'
feature
'
Collapse outdated diff comment
s'
,
js:
true
do
feature
'
Resolve outdated diff discussion
s'
,
js:
true
do
let
(
:merge_request
)
{
create
(
:merge_request
,
importing:
true
)
}
let
(
:merge_request
)
{
create
(
:merge_request
,
importing:
true
)
}
let
(
:project
)
{
merge_request
.
source_project
}
let
(
:project
)
{
merge_request
.
source_project
}
...
@@ -23,9 +23,9 @@ feature 'Collapse outdated diff comments', js: true do
...
@@ -23,9 +23,9 @@ feature 'Collapse outdated diff comments', js: true do
sign_in
(
create
(
:admin
))
sign_in
(
create
(
:admin
))
end
end
context
'when project.
collapse_outdated_diff_comment
s == true'
do
context
'when project.
resolve_outdated_diff_discussion
s == true'
do
before
do
before
do
project
.
update_column
(
:
collapse_outdated_diff_comment
s
,
true
)
project
.
update_column
(
:
resolve_outdated_diff_discussion
s
,
true
)
end
end
context
'with unresolved outdated discussions'
do
context
'with unresolved outdated discussions'
do
...
@@ -33,6 +33,7 @@ feature 'Collapse outdated diff comments', js: true do
...
@@ -33,6 +33,7 @@ feature 'Collapse outdated diff comments', js: true do
visit_merge_request
(
merge_request
)
visit_merge_request
(
merge_request
)
within
(
".discussion[data-discussion-id='
#{
outdated_discussion
.
id
}
']"
)
do
within
(
".discussion[data-discussion-id='
#{
outdated_discussion
.
id
}
']"
)
do
expect
(
page
).
to
have_css
(
'.discussion-body .hide .js-toggle-content'
,
visible:
false
)
expect
(
page
).
to
have_css
(
'.discussion-body .hide .js-toggle-content'
,
visible:
false
)
expect
(
page
).
to
have_content
(
'Automatically resolved'
)
end
end
end
end
end
end
...
@@ -42,14 +43,15 @@ feature 'Collapse outdated diff comments', js: true do
...
@@ -42,14 +43,15 @@ feature 'Collapse outdated diff comments', js: true do
visit_merge_request
(
merge_request
)
visit_merge_request
(
merge_request
)
within
(
".discussion[data-discussion-id='
#{
active_discussion
.
id
}
']"
)
do
within
(
".discussion[data-discussion-id='
#{
active_discussion
.
id
}
']"
)
do
expect
(
page
).
to
have_css
(
'.discussion-body .hide .js-toggle-content'
,
visible:
true
)
expect
(
page
).
to
have_css
(
'.discussion-body .hide .js-toggle-content'
,
visible:
true
)
expect
(
page
).
not_to
have_content
(
'Automatically resolved'
)
end
end
end
end
end
end
end
end
context
'when project.
collapse_outdated_diff_comment
s == false'
do
context
'when project.
resolve_outdated_diff_discussion
s == false'
do
before
do
before
do
project
.
update_column
(
:
collapse_outdated_diff_comment
s
,
false
)
project
.
update_column
(
:
resolve_outdated_diff_discussion
s
,
false
)
end
end
context
'with unresolved outdated discussions'
do
context
'with unresolved outdated discussions'
do
...
@@ -57,6 +59,7 @@ feature 'Collapse outdated diff comments', js: true do
...
@@ -57,6 +59,7 @@ feature 'Collapse outdated diff comments', js: true do
visit_merge_request
(
merge_request
)
visit_merge_request
(
merge_request
)
within
(
".discussion[data-discussion-id='
#{
outdated_discussion
.
id
}
']"
)
do
within
(
".discussion[data-discussion-id='
#{
outdated_discussion
.
id
}
']"
)
do
expect
(
page
).
to
have_css
(
'.discussion-body .hide .js-toggle-content'
,
visible:
true
)
expect
(
page
).
to
have_css
(
'.discussion-body .hide .js-toggle-content'
,
visible:
true
)
expect
(
page
).
not_to
have_content
(
'Automatically resolved'
)
end
end
end
end
end
end
...
@@ -66,6 +69,7 @@ feature 'Collapse outdated diff comments', js: true do
...
@@ -66,6 +69,7 @@ feature 'Collapse outdated diff comments', js: true do
visit_merge_request
(
merge_request
)
visit_merge_request
(
merge_request
)
within
(
".discussion[data-discussion-id='
#{
active_discussion
.
id
}
']"
)
do
within
(
".discussion[data-discussion-id='
#{
active_discussion
.
id
}
']"
)
do
expect
(
page
).
to
have_css
(
'.discussion-body .hide .js-toggle-content'
,
visible:
true
)
expect
(
page
).
to
have_css
(
'.discussion-body .hide .js-toggle-content'
,
visible:
true
)
expect
(
page
).
not_to
have_content
(
'Automatically resolved'
)
end
end
end
end
end
end
...
...
spec/requests/api/projects_spec.rb
View file @
a3f76b76
...
@@ -414,7 +414,7 @@ describe API::Projects do
...
@@ -414,7 +414,7 @@ describe API::Projects do
jobs_enabled:
false
,
jobs_enabled:
false
,
merge_requests_enabled:
false
,
merge_requests_enabled:
false
,
wiki_enabled:
false
,
wiki_enabled:
false
,
collapse_outdated_diff_comment
s:
false
,
resolve_outdated_diff_discussion
s:
false
,
only_allow_merge_if_pipeline_succeeds:
false
,
only_allow_merge_if_pipeline_succeeds:
false
,
request_access_enabled:
true
,
request_access_enabled:
true
,
only_allow_merge_if_all_discussions_are_resolved:
false
,
only_allow_merge_if_all_discussions_are_resolved:
false
,
...
@@ -478,16 +478,16 @@ describe API::Projects do
...
@@ -478,16 +478,16 @@ describe API::Projects do
expect
(
json_response
[
'avatar_url'
]).
to
eq
(
"http://localhost/uploads/-/system/project/avatar/
#{
project_id
}
/banana_sample.gif"
)
expect
(
json_response
[
'avatar_url'
]).
to
eq
(
"http://localhost/uploads/-/system/project/avatar/
#{
project_id
}
/banana_sample.gif"
)
end
end
it
'sets a project as allowing outdated diff
comments to collapse regardless of discussion resolution
'
do
it
'sets a project as allowing outdated diff
discussions to automatically resolve
'
do
project
=
attributes_for
(
:project
,
{
collapse_outdated_diff_comment
s:
false
})
project
=
attributes_for
(
:project
,
{
resolve_outdated_diff_discussion
s:
false
})
post
api
(
'/projects'
,
user
),
project
post
api
(
'/projects'
,
user
),
project
expect
(
json_response
[
'
collapse_outdated_diff_comment
s'
]).
to
be_falsey
expect
(
json_response
[
'
resolve_outdated_diff_discussion
s'
]).
to
be_falsey
end
end
it
'sets a project as allowing outdated diff
comments to collapse if collapse_outdated_diff_comment
s'
do
it
'sets a project as allowing outdated diff
discussions to automatically resolve if resolve_outdated_diff_discussion
s'
do
project
=
attributes_for
(
:project
,
{
collapse_outdated_diff_comment
s:
true
})
project
=
attributes_for
(
:project
,
{
resolve_outdated_diff_discussion
s:
true
})
post
api
(
'/projects'
,
user
),
project
post
api
(
'/projects'
,
user
),
project
expect
(
json_response
[
'
collapse_outdated_diff_comment
s'
]).
to
be_truthy
expect
(
json_response
[
'
resolve_outdated_diff_discussion
s'
]).
to
be_truthy
end
end
it
'sets a project as allowing merge even if build fails'
do
it
'sets a project as allowing merge even if build fails'
do
...
@@ -655,20 +655,20 @@ describe API::Projects do
...
@@ -655,20 +655,20 @@ describe API::Projects do
expect
(
json_response
[
'visibility'
]).
to
eq
(
'private'
)
expect
(
json_response
[
'visibility'
]).
to
eq
(
'private'
)
end
end
it
'sets a project as allowing outdated diff
comments to collapse regardless of discussion resolution
'
do
it
'sets a project as allowing outdated diff
discussions to automatically resolve
'
do
project
=
attributes_for
(
:project
,
{
collapse_outdated_diff_comment
s:
false
})
project
=
attributes_for
(
:project
,
{
resolve_outdated_diff_discussion
s:
false
})
post
api
(
"/projects/user/
#{
user
.
id
}
"
,
admin
),
project
post
api
(
"/projects/user/
#{
user
.
id
}
"
,
admin
),
project
expect
(
json_response
[
'
collapse_outdated_diff_comment
s'
]).
to
be_falsey
expect
(
json_response
[
'
resolve_outdated_diff_discussion
s'
]).
to
be_falsey
end
end
it
'sets a project as allowing outdated diff
comments to collapse only if collapse_outdated_diff_comment
s'
do
it
'sets a project as allowing outdated diff
discussions to automatically resolve only if resolve_outdated_diff_discussion
s'
do
project
=
attributes_for
(
:project
,
{
collapse_outdated_diff_comment
s:
true
})
project
=
attributes_for
(
:project
,
{
resolve_outdated_diff_discussion
s:
true
})
post
api
(
"/projects/user/
#{
user
.
id
}
"
,
admin
),
project
post
api
(
"/projects/user/
#{
user
.
id
}
"
,
admin
),
project
expect
(
json_response
[
'
collapse_outdated_diff_comment
s'
]).
to
be_truthy
expect
(
json_response
[
'
resolve_outdated_diff_discussion
s'
]).
to
be_truthy
end
end
it
'sets a project as allowing merge even if build fails'
do
it
'sets a project as allowing merge even if build fails'
do
...
@@ -761,7 +761,7 @@ describe API::Projects do
...
@@ -761,7 +761,7 @@ describe API::Projects do
expect
(
json_response
[
'wiki_enabled'
]).
to
be_present
expect
(
json_response
[
'wiki_enabled'
]).
to
be_present
expect
(
json_response
[
'jobs_enabled'
]).
to
be_present
expect
(
json_response
[
'jobs_enabled'
]).
to
be_present
expect
(
json_response
[
'snippets_enabled'
]).
to
be_present
expect
(
json_response
[
'snippets_enabled'
]).
to
be_present
expect
(
json_response
[
'
collapse_outdated_diff_comments'
]).
to
eq
(
project
.
collapse_outdated_diff_comment
s
)
expect
(
json_response
[
'
resolve_outdated_diff_discussions'
]).
to
eq
(
project
.
resolve_outdated_diff_discussion
s
)
expect
(
json_response
[
'container_registry_enabled'
]).
to
be_present
expect
(
json_response
[
'container_registry_enabled'
]).
to
be_present
expect
(
json_response
[
'created_at'
]).
to
be_present
expect
(
json_response
[
'created_at'
]).
to
be_present
expect
(
json_response
[
'last_activity_at'
]).
to
be_present
expect
(
json_response
[
'last_activity_at'
]).
to
be_present
...
...
spec/requests/api/v3/projects_spec.rb
View file @
a3f76b76
...
@@ -394,7 +394,7 @@ describe API::V3::Projects do
...
@@ -394,7 +394,7 @@ describe API::V3::Projects do
issues_enabled:
false
,
issues_enabled:
false
,
merge_requests_enabled:
false
,
merge_requests_enabled:
false
,
wiki_enabled:
false
,
wiki_enabled:
false
,
collapse_outdated_diff_comment
s:
false
,
resolve_outdated_diff_discussion
s:
false
,
only_allow_merge_if_build_succeeds:
false
,
only_allow_merge_if_build_succeeds:
false
,
request_access_enabled:
true
,
request_access_enabled:
true
,
only_allow_merge_if_all_discussions_are_resolved:
false
only_allow_merge_if_all_discussions_are_resolved:
false
...
@@ -456,16 +456,16 @@ describe API::V3::Projects do
...
@@ -456,16 +456,16 @@ describe API::V3::Projects do
expect
(
json_response
[
'visibility_level'
]).
to
eq
(
Gitlab
::
VisibilityLevel
::
PRIVATE
)
expect
(
json_response
[
'visibility_level'
]).
to
eq
(
Gitlab
::
VisibilityLevel
::
PRIVATE
)
end
end
it
'sets a project as allowing outdated diff
comments to collapse regardless of discussion resolution
'
do
it
'sets a project as allowing outdated diff
discussions to automatically resolve
'
do
project
=
attributes_for
(
:project
,
{
collapse_outdated_diff_comment
s:
false
})
project
=
attributes_for
(
:project
,
{
resolve_outdated_diff_discussion
s:
false
})
post
v3_api
(
'/projects'
,
user
),
project
post
v3_api
(
'/projects'
,
user
),
project
expect
(
json_response
[
'
collapse_outdated_diff_comment
s'
]).
to
be_falsey
expect
(
json_response
[
'
resolve_outdated_diff_discussion
s'
]).
to
be_falsey
end
end
it
'sets a project as allowing outdated diff
comments to collapse if collapse_outdated_diff_comment
s'
do
it
'sets a project as allowing outdated diff
discussions to automatically resolve if resolve_outdated_diff_discussion
s'
do
project
=
attributes_for
(
:project
,
{
collapse_outdated_diff_comment
s:
true
})
project
=
attributes_for
(
:project
,
{
resolve_outdated_diff_discussion
s:
true
})
post
v3_api
(
'/projects'
,
user
),
project
post
v3_api
(
'/projects'
,
user
),
project
expect
(
json_response
[
'
collapse_outdated_diff_comment
s'
]).
to
be_truthy
expect
(
json_response
[
'
resolve_outdated_diff_discussion
s'
]).
to
be_truthy
end
end
it
'sets a project as allowing merge even if build fails'
do
it
'sets a project as allowing merge even if build fails'
do
...
@@ -612,16 +612,16 @@ describe API::V3::Projects do
...
@@ -612,16 +612,16 @@ describe API::V3::Projects do
expect
(
json_response
[
'visibility_level'
]).
to
eq
(
Gitlab
::
VisibilityLevel
::
PRIVATE
)
expect
(
json_response
[
'visibility_level'
]).
to
eq
(
Gitlab
::
VisibilityLevel
::
PRIVATE
)
end
end
it
'sets a project as allowing outdated diff
comments to collapse regardless of discussion resolution
'
do
it
'sets a project as allowing outdated diff
discussions to automatically resolve
'
do
project
=
attributes_for
(
:project
,
{
collapse_outdated_diff_comment
s:
false
})
project
=
attributes_for
(
:project
,
{
resolve_outdated_diff_discussion
s:
false
})
post
v3_api
(
"/projects/user/
#{
user
.
id
}
"
,
admin
),
project
post
v3_api
(
"/projects/user/
#{
user
.
id
}
"
,
admin
),
project
expect
(
json_response
[
'
collapse_outdated_diff_comment
s'
]).
to
be_falsey
expect
(
json_response
[
'
resolve_outdated_diff_discussion
s'
]).
to
be_falsey
end
end
it
'sets a project as allowing outdated diff
comments to collapse only if collapse_outdated_diff_comment
s'
do
it
'sets a project as allowing outdated diff
discussions to automatically resolve only if resolve_outdated_diff_discussion
s'
do
project
=
attributes_for
(
:project
,
{
collapse_outdated_diff_comment
s:
true
})
project
=
attributes_for
(
:project
,
{
resolve_outdated_diff_discussion
s:
true
})
post
v3_api
(
"/projects/user/
#{
user
.
id
}
"
,
admin
),
project
post
v3_api
(
"/projects/user/
#{
user
.
id
}
"
,
admin
),
project
expect
(
json_response
[
'
collapse_outdated_diff_comment
s'
]).
to
be_truthy
expect
(
json_response
[
'
resolve_outdated_diff_discussion
s'
]).
to
be_truthy
end
end
it
'sets a project as allowing merge even if build fails'
do
it
'sets a project as allowing merge even if build fails'
do
...
@@ -712,7 +712,7 @@ describe API::V3::Projects do
...
@@ -712,7 +712,7 @@ describe API::V3::Projects do
expect
(
json_response
[
'wiki_enabled'
]).
to
be_present
expect
(
json_response
[
'wiki_enabled'
]).
to
be_present
expect
(
json_response
[
'builds_enabled'
]).
to
be_present
expect
(
json_response
[
'builds_enabled'
]).
to
be_present
expect
(
json_response
[
'snippets_enabled'
]).
to
be_present
expect
(
json_response
[
'snippets_enabled'
]).
to
be_present
expect
(
json_response
[
'
collapse_outdated_diff_comments'
]).
to
eq
(
project
.
collapse_outdated_diff_comment
s
)
expect
(
json_response
[
'
resolve_outdated_diff_discussions'
]).
to
eq
(
project
.
resolve_outdated_diff_discussion
s
)
expect
(
json_response
[
'container_registry_enabled'
]).
to
be_present
expect
(
json_response
[
'container_registry_enabled'
]).
to
be_present
expect
(
json_response
[
'created_at'
]).
to
be_present
expect
(
json_response
[
'created_at'
]).
to
be_present
expect
(
json_response
[
'last_activity_at'
]).
to
be_present
expect
(
json_response
[
'last_activity_at'
]).
to
be_present
...
...
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