Commit a3f76b76 authored by Ashley Dumaine's avatar Ashley Dumaine Committed by Sean McGivern

change collapse to resolve and comments to discussions

parent 959e6d22
...@@ -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_comments, :resolve_outdated_diff_discussions,
:container_registry_enabled, :container_registry_enabled,
:default_branch, :default_branch,
:description, :description,
......
...@@ -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?
......
...@@ -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_comments, false default_value_for :resolve_outdated_diff_discussions, 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 }
......
- if discussion.resolved? - if discussion.resolved?
- if project.resolve_outdated_diff_discussions
.discussion-headline-light.js-discussion-headline
Automatically resolved
- if discussion.resolved_by
by
= 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 .discussion-headline-light.js-discussion-headline
Resolved Resolved
- if discussion.resolved_by - if discussion.resolved_by
......
...@@ -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
--- ---
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
# 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_comments, :resolve_outdated_diff_discussions,
:boolean, :boolean,
default: false) default: false)
end end
def down def down
remove_column(:projects, :collapse_outdated_diff_comments) remove_column(:projects, :resolve_outdated_diff_discussions)
end end
end end
...@@ -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_comments", default: false, null: false t.boolean "resolve_outdated_diff_discussions", 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"
......
...@@ -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_comments": false, "resolve_outdated_diff_discussions": 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_comments": false, "resolve_outdated_diff_discussions": 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_comments": false, "resolve_outdated_diff_discussions": 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_comments": false, "resolve_outdated_diff_discussions": 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_comments": false, "resolve_outdated_diff_discussions": 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_comments": false, "resolve_outdated_diff_discussions": 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_comments": false, "resolve_outdated_diff_discussions": 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_comments": false, "resolve_outdated_diff_discussions": 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_comments": false, "resolve_outdated_diff_discussions": 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",
......
...@@ -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 collapsed by default. From now on, any discussions on an outdated diff will be resolved by default.
## Threaded discussions ## Threaded discussions
......
...@@ -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_comments expose :resolve_outdated_diff_discussions
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
......
...@@ -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_comments, :resolve_outdated_diff_discussions,
:container_registry_enabled, :container_registry_enabled,
:default_branch, :default_branch,
:description, :description,
......
...@@ -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_comments expose :resolve_outdated_diff_discussions
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
......
...@@ -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_comments, :shared_runners_enabled, :resolve_outdated_diff_discussions,
: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,
......
require 'spec_helper' require 'spec_helper'
feature 'Collapse outdated diff comments', js: true do feature 'Resolve outdated diff discussions', 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_comments == true' do context 'when project.resolve_outdated_diff_discussions == true' do
before do before do
project.update_column(:collapse_outdated_diff_comments, true) project.update_column(:resolve_outdated_diff_discussions, 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_comments == false' do context 'when project.resolve_outdated_diff_discussions == false' do
before do before do
project.update_column(:collapse_outdated_diff_comments, false) project.update_column(:resolve_outdated_diff_discussions, 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
......
...@@ -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_comments: false, resolve_outdated_diff_discussions: 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_comments: false }) project = attributes_for(:project, { resolve_outdated_diff_discussions: false })
post api('/projects', user), project post api('/projects', user), project
expect(json_response['collapse_outdated_diff_comments']).to be_falsey expect(json_response['resolve_outdated_diff_discussions']).to be_falsey
end end
it 'sets a project as allowing outdated diff comments to collapse if collapse_outdated_diff_comments' do it 'sets a project as allowing outdated diff discussions to automatically resolve if resolve_outdated_diff_discussions' do
project = attributes_for(:project, { collapse_outdated_diff_comments: true }) project = attributes_for(:project, { resolve_outdated_diff_discussions: true })
post api('/projects', user), project post api('/projects', user), project
expect(json_response['collapse_outdated_diff_comments']).to be_truthy expect(json_response['resolve_outdated_diff_discussions']).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_comments: false }) project = attributes_for(:project, { resolve_outdated_diff_discussions: false })
post api("/projects/user/#{user.id}", admin), project post api("/projects/user/#{user.id}", admin), project
expect(json_response['collapse_outdated_diff_comments']).to be_falsey expect(json_response['resolve_outdated_diff_discussions']).to be_falsey
end end
it 'sets a project as allowing outdated diff comments to collapse only if collapse_outdated_diff_comments' do it 'sets a project as allowing outdated diff discussions to automatically resolve only if resolve_outdated_diff_discussions' do
project = attributes_for(:project, { collapse_outdated_diff_comments: true }) project = attributes_for(:project, { resolve_outdated_diff_discussions: true })
post api("/projects/user/#{user.id}", admin), project post api("/projects/user/#{user.id}", admin), project
expect(json_response['collapse_outdated_diff_comments']).to be_truthy expect(json_response['resolve_outdated_diff_discussions']).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_comments) expect(json_response['resolve_outdated_diff_discussions']).to eq(project.resolve_outdated_diff_discussions)
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
......
...@@ -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_comments: false, resolve_outdated_diff_discussions: 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_comments: false }) project = attributes_for(:project, { resolve_outdated_diff_discussions: false })
post v3_api('/projects', user), project post v3_api('/projects', user), project
expect(json_response['collapse_outdated_diff_comments']).to be_falsey expect(json_response['resolve_outdated_diff_discussions']).to be_falsey
end end
it 'sets a project as allowing outdated diff comments to collapse if collapse_outdated_diff_comments' do it 'sets a project as allowing outdated diff discussions to automatically resolve if resolve_outdated_diff_discussions' do
project = attributes_for(:project, { collapse_outdated_diff_comments: true }) project = attributes_for(:project, { resolve_outdated_diff_discussions: true })
post v3_api('/projects', user), project post v3_api('/projects', user), project
expect(json_response['collapse_outdated_diff_comments']).to be_truthy expect(json_response['resolve_outdated_diff_discussions']).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_comments: false }) project = attributes_for(:project, { resolve_outdated_diff_discussions: 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_comments']).to be_falsey expect(json_response['resolve_outdated_diff_discussions']).to be_falsey
end end
it 'sets a project as allowing outdated diff comments to collapse only if collapse_outdated_diff_comments' do it 'sets a project as allowing outdated diff discussions to automatically resolve only if resolve_outdated_diff_discussions' do
project = attributes_for(:project, { collapse_outdated_diff_comments: true }) project = attributes_for(:project, { resolve_outdated_diff_discussions: 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_comments']).to be_truthy expect(json_response['resolve_outdated_diff_discussions']).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_comments) expect(json_response['resolve_outdated_diff_discussions']).to eq(project.resolve_outdated_diff_discussions)
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
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment