Commit fa4c409d authored by Sean McGivern's avatar Sean McGivern

Merge branch 'issue/55953' into 'master'

rename `discussion` to `thread`

Closes #55953

See merge request gitlab-org/gitlab-ce!29553
parents 459e419e c587c1b8
...@@ -32,15 +32,15 @@ const CommentAndResolveBtn = Vue.extend({ ...@@ -32,15 +32,15 @@ const CommentAndResolveBtn = Vue.extend({
buttonText: function() { buttonText: function() {
if (this.isDiscussionResolved) { if (this.isDiscussionResolved) {
if (this.textareaIsEmpty) { if (this.textareaIsEmpty) {
return __('Unresolve discussion'); return __('Unresolve thread');
} else { } else {
return __('Comment & unresolve discussion'); return __('Comment & unresolve thread');
} }
} else { } else {
if (this.textareaIsEmpty) { if (this.textareaIsEmpty) {
return __('Resolve discussion'); return __('Resolve thread');
} else { } else {
return __('Comment & resolve discussion'); return __('Comment & resolve thread');
} }
} }
}, },
......
...@@ -65,7 +65,7 @@ export default { ...@@ -65,7 +65,7 @@ export default {
return this.getUserData.id; return this.getUserData.id;
}, },
commentButtonTitle() { commentButtonTitle() {
return this.noteType === constants.COMMENT ? 'Comment' : 'Start discussion'; return this.noteType === constants.COMMENT ? 'Comment' : 'Start thread';
}, },
startDiscussionDescription() { startDiscussionDescription() {
let text = 'Discuss a specific suggestion or question'; let text = 'Discuss a specific suggestion or question';
...@@ -418,7 +418,7 @@ append-right-10 comment-type-dropdown js-comment-type-dropdown droplab-dropdown" ...@@ -418,7 +418,7 @@ append-right-10 comment-type-dropdown js-comment-type-dropdown droplab-dropdown"
> >
<i aria-hidden="true" class="fa fa-check icon"> </i> <i aria-hidden="true" class="fa fa-check icon"> </i>
<div class="description"> <div class="description">
<strong>Start discussion</strong> <strong>Start thread</strong>
<p>{{ startDiscussionDescription }}</p> <p>{{ startDiscussionDescription }}</p>
</div> </div>
</button> </button>
......
...@@ -61,7 +61,7 @@ export default { ...@@ -61,7 +61,7 @@ export default {
</span> </span>
<span class="line-resolve-text"> <span class="line-resolve-text">
{{ resolvedDiscussionsCount }}/{{ resolvableDiscussionsCount }} {{ resolvedDiscussionsCount }}/{{ resolvableDiscussionsCount }}
{{ n__('discussion resolved', 'discussions resolved', resolvableDiscussionsCount) }} {{ n__('thread resolved', 'threads resolved', resolvableDiscussionsCount) }}
</span> </span>
</div> </div>
<div <div
...@@ -72,7 +72,7 @@ export default { ...@@ -72,7 +72,7 @@ export default {
<a <a
v-gl-tooltip v-gl-tooltip
:href="resolveAllDiscussionsIssuePath" :href="resolveAllDiscussionsIssuePath"
:title="s__('Resolve all discussions in new issue')" :title="s__('Resolve all threads in new issue')"
class="new-issue-for-discussion btn btn-default discussion-create-issue-btn" class="new-issue-for-discussion btn btn-default discussion-create-issue-btn"
> >
<icon name="issue-new" /> <icon name="issue-new" />
...@@ -81,7 +81,7 @@ export default { ...@@ -81,7 +81,7 @@ export default {
<div v-if="isLoggedIn && !allResolved" class="btn-group btn-group-sm" role="group"> <div v-if="isLoggedIn && !allResolved" class="btn-group btn-group-sm" role="group">
<button <button
v-gl-tooltip v-gl-tooltip
title="Jump to first unresolved discussion" title="Jump to first unresolved thread"
class="btn btn-default discussion-next-btn" class="btn btn-default discussion-next-btn"
@click="jumpToFirstUnresolvedDiscussion" @click="jumpToFirstUnresolvedDiscussion"
> >
......
...@@ -25,7 +25,7 @@ export default { ...@@ -25,7 +25,7 @@ export default {
<gl-button <gl-button
v-gl-tooltip v-gl-tooltip
:href="url" :href="url"
:title="s__('MergeRequests|Resolve this discussion in a new issue')" :title="s__('MergeRequests|Resolve this thread in a new issue')"
class="new-issue-for-discussion discussion-create-issue-btn" class="new-issue-for-discussion discussion-create-issue-btn"
> >
<icon name="issue-new" /> <icon name="issue-new" />
......
...@@ -283,11 +283,11 @@ export default { ...@@ -283,11 +283,11 @@ export default {
type="checkbox" type="checkbox"
class="qa-unresolve-review-discussion" class="qa-unresolve-review-discussion"
/> />
{{ __('Unresolve discussion') }} {{ __('Unresolve thread') }}
</template> </template>
<template v-else> <template v-else>
<input v-model="isResolving" type="checkbox" class="qa-resolve-review-discussion" /> <input v-model="isResolving" type="checkbox" class="qa-resolve-review-discussion" />
{{ __('Resolve discussion') }} {{ __('Resolve thread') }}
</template> </template>
</label> </label>
</p> </p>
......
...@@ -70,7 +70,7 @@ export default { ...@@ -70,7 +70,7 @@ export default {
@click="handleToggle" @click="handleToggle"
> >
<i :class="toggleChevronClass" class="fa" aria-hidden="true"></i> <i :class="toggleChevronClass" class="fa" aria-hidden="true"></i>
{{ __('Toggle discussion') }} {{ __('Toggle thread') }}
</button> </button>
</div> </div>
<a <a
......
...@@ -174,22 +174,20 @@ export default { ...@@ -174,22 +174,20 @@ export default {
active: isActive, active: isActive,
} = this.discussion; } = this.discussion;
let text = s__('MergeRequests|started a discussion'); let text = s__('MergeRequests|started a thread');
if (isForCommit) { if (isForCommit) {
text = s__( text = s__('MergeRequests|started a thread on commit %{linkStart}%{commitId}%{linkEnd}');
'MergeRequests|started a discussion on commit %{linkStart}%{commitId}%{linkEnd}',
);
} else if (isDiffDiscussion && commitId) { } else if (isDiffDiscussion && commitId) {
text = isActive text = isActive
? s__('MergeRequests|started a discussion on commit %{linkStart}%{commitId}%{linkEnd}') ? s__('MergeRequests|started a thread on commit %{linkStart}%{commitId}%{linkEnd}')
: s__( : s__(
'MergeRequests|started a discussion on an outdated change in commit %{linkStart}%{commitId}%{linkEnd}', 'MergeRequests|started a thread on an outdated change in commit %{linkStart}%{commitId}%{linkEnd}',
); );
} else if (isDiffDiscussion) { } else if (isDiffDiscussion) {
text = isActive text = isActive
? s__('MergeRequests|started a discussion on %{linkStart}the diff%{linkEnd}') ? s__('MergeRequests|started a thread on %{linkStart}the diff%{linkEnd}')
: s__( : s__(
'MergeRequests|started a discussion on %{linkStart}an old version of the diff%{linkEnd}', 'MergeRequests|started a thread on %{linkStart}an old version of the diff%{linkEnd}',
); );
} }
......
...@@ -20,13 +20,13 @@ export default { ...@@ -20,13 +20,13 @@ export default {
resolveButtonTitle() { resolveButtonTitle() {
if (this.updatedNoteBody) { if (this.updatedNoteBody) {
if (this.discussionResolved) { if (this.discussionResolved) {
return __('Comment & unresolve discussion'); return __('Comment & unresolve thread');
} }
return __('Comment & resolve discussion'); return __('Comment & resolve thread');
} }
return this.discussionResolved ? __('Unresolve discussion') : __('Resolve discussion'); return this.discussionResolved ? __('Unresolve thread') : __('Resolve thread');
}, },
}, },
methods: { methods: {
......
...@@ -20,7 +20,7 @@ export default { ...@@ -20,7 +20,7 @@ export default {
<status-icon :show-disabled-button="true" status="warning" /> <status-icon :show-disabled-button="true" status="warning" />
<div class="media-body space-children"> <div class="media-body space-children">
<span class="bold"> <span class="bold">
{{ s__('mrWidget|There are unresolved discussions. Please resolve these discussions') }} {{ s__('mrWidget|There are unresolved threads. Please resolve these threads') }}
</span> </span>
<a <a
v-if="mr.createIssueToResolveDiscussionsPath" v-if="mr.createIssueToResolveDiscussionsPath"
......
...@@ -249,7 +249,7 @@ module SystemNoteService ...@@ -249,7 +249,7 @@ module SystemNoteService
end end
def resolve_all_discussions(merge_request, project, author) def resolve_all_discussions(merge_request, project, author)
body = "resolved all discussions" body = "resolved all threads"
create_note(NoteSummary.new(merge_request, project, author, body, action: 'discussion')) create_note(NoteSummary.new(merge_request, project, author, body, action: 'discussion'))
end end
......
...@@ -13,12 +13,12 @@ ...@@ -13,12 +13,12 @@
= icon("chevron-up") = icon("chevron-up")
- else - else
= icon("chevron-down") = icon("chevron-down")
= _('Toggle discussion') = _('Toggle thread')
= link_to_member(@project, discussion.author, avatar: false) = link_to_member(@project, discussion.author, avatar: false)
.inline.discussion-headline-light .inline.discussion-headline-light
= discussion.author.to_reference = discussion.author.to_reference
started a discussion started a thread
- url = discussion_path(discussion) - url = discussion_path(discussion)
- if discussion.for_commit? && @noteable != discussion.noteable - if discussion.for_commit? && @noteable != discussion.noteable
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
.btn-group{ role: "group", "v-if" => "showButton" } .btn-group{ role: "group", "v-if" => "showButton" }
= link_to custom_icon('icon_mr_issue'), = link_to custom_icon('icon_mr_issue'),
new_project_issue_path(@project, merge_request_to_resolve_discussions_of: merge_request.iid, discussion_to_resolve: discussion.id), new_project_issue_path(@project, merge_request_to_resolve_discussions_of: merge_request.iid, discussion_to_resolve: discussion.id),
title: 'Resolve this discussion in a new issue', title: 'Resolve this thread in a new issue',
aria: { label: 'Resolve this discussion in a new issue' }, aria: { label: 'Resolve this thread in a new issue' },
data: { container: 'body' }, data: { container: 'body' },
class: 'new-issue-for-discussion btn btn-default discussion-create-issue-btn has-tooltip' class: 'new-issue-for-discussion btn btn-default discussion-create-issue-btn has-tooltip'
...@@ -48,13 +48,13 @@ ...@@ -48,13 +48,13 @@
= hidden_field_tag 'merge_request_to_resolve_discussions_of', @merge_request_to_resolve_discussions_of.iid = hidden_field_tag 'merge_request_to_resolve_discussions_of', @merge_request_to_resolve_discussions_of.iid
- if @discussion_to_resolve - if @discussion_to_resolve
= hidden_field_tag 'discussion_to_resolve', @discussion_to_resolve.id = hidden_field_tag 'discussion_to_resolve', @discussion_to_resolve.id
Creating this issue will resolve the discussion in Creating this issue will resolve the thread in
- else - else
Creating this issue will resolve all discussions in Creating this issue will resolve all threads in
= link_to_discussions_to_resolve(@merge_request_to_resolve_discussions_of, @discussion_to_resolve) = link_to_discussions_to_resolve(@merge_request_to_resolve_discussions_of, @discussion_to_resolve)
- else - else
The The
= @discussion_to_resolve ? 'discussion' : 'discussions' = @discussion_to_resolve ? 'thread' : 'threads'
at at
= link_to_discussions_to_resolve(@merge_request_to_resolve_discussions_of, @discussion_to_resolve) = link_to_discussions_to_resolve(@merge_request_to_resolve_discussions_of, @discussion_to_resolve)
will stay unresolved. Ask someone with permission to resolve will stay unresolved. Ask someone with permission to resolve
......
...@@ -18,11 +18,11 @@ ...@@ -18,11 +18,11 @@
%li.divider.droplab-item-ignore %li.divider.droplab-item-ignore
%li#discussion{ data: { value: 'DiscussionNote', 'submit-text' => _('Start discussion'), 'close-text' => _("Start discussion & close %{noteable_name}") % { noteable_name: noteable_name }, 'reopen-text' => _("Start discussion & reopen %{noteable_name}") % { noteable_name: noteable_name } } } %li#discussion{ data: { value: 'DiscussionNote', 'submit-text' => _('Start thread'), 'close-text' => _("Start thread & close %{noteable_name}") % { noteable_name: noteable_name }, 'reopen-text' => _("Start thread & reopen %{noteable_name}") % { noteable_name: noteable_name } } }
%button.btn.btn-transparent %button.btn.btn-transparent
= icon('check', class: 'icon') = icon('check', class: 'icon')
.description .description
%strong= _("Start discussion") %strong= _("Start thread")
%p %p
= succeed '.' do = succeed '.' do
- if @note.noteable.supports_resolvable_notes? - if @note.noteable.supports_resolvable_notes?
......
---
title: "renamed discussion to thread in merge-request and issue timeline"
merge_request: 29553
author: Michel Engelen
type: changed
...@@ -2770,10 +2770,10 @@ msgstr "" ...@@ -2770,10 +2770,10 @@ msgstr ""
msgid "Comment & reopen %{noteable_name}" msgid "Comment & reopen %{noteable_name}"
msgstr "" msgstr ""
msgid "Comment & resolve discussion" msgid "Comment & resolve thread"
msgstr "" msgstr ""
msgid "Comment & unresolve discussion" msgid "Comment & unresolve thread"
msgstr "" msgstr ""
msgid "Comment form position" msgid "Comment form position"
...@@ -6328,7 +6328,7 @@ msgstr "" ...@@ -6328,7 +6328,7 @@ msgstr ""
msgid "MergeRequests|Reply..." msgid "MergeRequests|Reply..."
msgstr "" msgstr ""
msgid "MergeRequests|Resolve this discussion in a new issue" msgid "MergeRequests|Resolve this thread in a new issue"
msgstr "" msgstr ""
msgid "MergeRequests|Saving the comment failed" msgid "MergeRequests|Saving the comment failed"
...@@ -6349,19 +6349,19 @@ msgstr "" ...@@ -6349,19 +6349,19 @@ msgstr ""
msgid "MergeRequests|commented on commit %{commitLink}" msgid "MergeRequests|commented on commit %{commitLink}"
msgstr "" msgstr ""
msgid "MergeRequests|started a discussion" msgid "MergeRequests|started a thread"
msgstr "" msgstr ""
msgid "MergeRequests|started a discussion on %{linkStart}an old version of the diff%{linkEnd}" msgid "MergeRequests|started a thread on %{linkStart}an old version of the diff%{linkEnd}"
msgstr "" msgstr ""
msgid "MergeRequests|started a discussion on %{linkStart}the diff%{linkEnd}" msgid "MergeRequests|started a thread on %{linkStart}the diff%{linkEnd}"
msgstr "" msgstr ""
msgid "MergeRequests|started a discussion on an outdated change in commit %{linkStart}%{commitId}%{linkEnd}" msgid "MergeRequests|started a thread on an outdated change in commit %{linkStart}%{commitId}%{linkEnd}"
msgstr "" msgstr ""
msgid "MergeRequests|started a discussion on commit %{linkStart}%{commitId}%{linkEnd}" msgid "MergeRequests|started a thread on commit %{linkStart}%{commitId}%{linkEnd}"
msgstr "" msgstr ""
msgid "MergeRequest| %{paragraphStart}changed the description %{descriptionChangedTimes} times %{timeDifferenceMinutes}%{paragraphEnd}" msgid "MergeRequest| %{paragraphStart}changed the description %{descriptionChangedTimes} times %{timeDifferenceMinutes}%{paragraphEnd}"
...@@ -8791,7 +8791,7 @@ msgstr "" ...@@ -8791,7 +8791,7 @@ msgstr ""
msgid "Reset template" msgid "Reset template"
msgstr "" msgstr ""
msgid "Resolve all discussions in new issue" msgid "Resolve all threads in new issue"
msgstr "" msgstr ""
msgid "Resolve conflicts on source branch" msgid "Resolve conflicts on source branch"
...@@ -8800,6 +8800,9 @@ msgstr "" ...@@ -8800,6 +8800,9 @@ msgstr ""
msgid "Resolve discussion" msgid "Resolve discussion"
msgstr "" msgstr ""
msgid "Resolve thread"
msgstr ""
msgid "Resolved" msgid "Resolved"
msgstr "" msgstr ""
...@@ -9842,16 +9845,16 @@ msgstr "" ...@@ -9842,16 +9845,16 @@ msgstr ""
msgid "Start date" msgid "Start date"
msgstr "" msgstr ""
msgid "Start discussion" msgid "Start the Runner!"
msgstr "" msgstr ""
msgid "Start discussion & close %{noteable_name}" msgid "Start thread"
msgstr "" msgstr ""
msgid "Start discussion & reopen %{noteable_name}" msgid "Start thread & close %{noteable_name}"
msgstr "" msgstr ""
msgid "Start the Runner!" msgid "Start thread & reopen %{noteable_name}"
msgstr "" msgstr ""
msgid "Started" msgid "Started"
...@@ -11111,15 +11114,15 @@ msgstr "" ...@@ -11111,15 +11114,15 @@ msgstr ""
msgid "Toggle commit list" msgid "Toggle commit list"
msgstr "" msgstr ""
msgid "Toggle discussion"
msgstr ""
msgid "Toggle emoji award" msgid "Toggle emoji award"
msgstr "" msgstr ""
msgid "Toggle navigation" msgid "Toggle navigation"
msgstr "" msgstr ""
msgid "Toggle thread"
msgstr ""
msgid "ToggleButton|Toggle Status: OFF" msgid "ToggleButton|Toggle Status: OFF"
msgstr "" msgstr ""
...@@ -11330,6 +11333,9 @@ msgstr "" ...@@ -11330,6 +11333,9 @@ msgstr ""
msgid "Unresolve discussion" msgid "Unresolve discussion"
msgstr "" msgstr ""
msgid "Unresolve thread"
msgstr ""
msgid "Unschedule job" msgid "Unschedule job"
msgstr "" msgstr ""
...@@ -12486,11 +12492,6 @@ msgstr "" ...@@ -12486,11 +12492,6 @@ msgstr ""
msgid "disabled" msgid "disabled"
msgstr "" msgstr ""
msgid "discussion resolved"
msgid_plural "discussions resolved"
msgstr[0] ""
msgstr[1] ""
msgid "done" msgid "done"
msgstr "" msgstr ""
...@@ -12793,7 +12794,7 @@ msgstr "" ...@@ -12793,7 +12794,7 @@ msgstr ""
msgid "mrWidget|There are merge conflicts" msgid "mrWidget|There are merge conflicts"
msgstr "" msgstr ""
msgid "mrWidget|There are unresolved discussions. Please resolve these discussions" msgid "mrWidget|There are unresolved threads. Please resolve these threads"
msgstr "" msgstr ""
msgid "mrWidget|This feature merges changes from the target branch to the source branch. You cannot use this feature since the source branch is protected." msgid "mrWidget|This feature merges changes from the target branch to the source branch. You cannot use this feature since the source branch is protected."
...@@ -12964,6 +12965,11 @@ msgstr "" ...@@ -12964,6 +12965,11 @@ msgstr ""
msgid "this document" msgid "this document"
msgstr "" msgstr ""
msgid "thread resolved"
msgid_plural "threads resolved"
msgstr[0] ""
msgstr[1] ""
msgid "to list" msgid "to list"
msgstr "" msgstr ""
......
require 'spec_helper' require 'spec_helper'
describe 'Discussion Comments Commit', :js do describe 'Thread Comments Commit', :js do
include RepoHelpers include RepoHelpers
let(:user) { create(:user) } let(:user) { create(:user) }
...@@ -16,7 +16,7 @@ describe 'Discussion Comments Commit', :js do ...@@ -16,7 +16,7 @@ describe 'Discussion Comments Commit', :js do
visit project_commit_path(project, sample_commit.id) visit project_commit_path(project, sample_commit.id)
end end
it_behaves_like 'discussion comments', 'commit' it_behaves_like 'thread comments', 'commit'
it 'has class .js-note-emoji' do it 'has class .js-note-emoji' do
expect(page).to have_css('.js-note-emoji') expect(page).to have_css('.js-note-emoji')
......
require 'spec_helper' require 'spec_helper'
describe 'Discussion Comments Issue', :js do describe 'Thread Comments Issue', :js do
let(:user) { create(:user) } let(:user) { create(:user) }
let(:project) { create(:project) } let(:project) { create(:project) }
let(:issue) { create(:issue, project: project) } let(:issue) { create(:issue, project: project) }
...@@ -12,5 +12,5 @@ describe 'Discussion Comments Issue', :js do ...@@ -12,5 +12,5 @@ describe 'Discussion Comments Issue', :js do
visit project_issue_path(project, issue) visit project_issue_path(project, issue)
end end
it_behaves_like 'discussion comments', 'issue' it_behaves_like 'thread comments', 'issue'
end end
require 'spec_helper' require 'spec_helper'
describe 'Discussion Comments Merge Request', :js do describe 'Thread Comments Merge Request', :js do
let(:user) { create(:user) } let(:user) { create(:user) }
let(:project) { create(:project, :repository) } let(:project) { create(:project, :repository) }
let(:merge_request) { create(:merge_request, source_project: project) } let(:merge_request) { create(:merge_request, source_project: project) }
...@@ -12,5 +12,5 @@ describe 'Discussion Comments Merge Request', :js do ...@@ -12,5 +12,5 @@ describe 'Discussion Comments Merge Request', :js do
visit project_merge_request_path(project, merge_request) visit project_merge_request_path(project, merge_request)
end end
it_behaves_like 'discussion comments', 'merge request' it_behaves_like 'thread comments', 'merge request'
end end
require 'spec_helper' require 'spec_helper'
describe 'Discussion Comments Snippet', :js do describe 'Thread Comments Snippet', :js do
let(:user) { create(:user) } let(:user) { create(:user) }
let(:project) { create(:project) } let(:project) { create(:project) }
let(:snippet) { create(:project_snippet, :private, project: project, author: user) } let(:snippet) { create(:project_snippet, :private, project: project, author: user) }
...@@ -12,5 +12,5 @@ describe 'Discussion Comments Snippet', :js do ...@@ -12,5 +12,5 @@ describe 'Discussion Comments Snippet', :js do
visit project_snippet_path(project, snippet) visit project_snippet_path(project, snippet)
end end
it_behaves_like 'discussion comments', 'snippet' it_behaves_like 'thread comments', 'snippet'
end end
require 'rails_helper' require 'rails_helper'
describe 'Resolving all open discussions in a merge request from an issue', :js do describe 'Resolving all open threads in a merge request from an issue', :js do
let(:user) { create(:user) } let(:user) { create(:user) }
let(:project) { create(:project, :repository) } let(:project) { create(:project, :repository) }
let(:merge_request) { create(:merge_request, source_project: project) } let(:merge_request) { create(:merge_request, source_project: project) }
let!(:discussion) { create(:diff_note_on_merge_request, noteable: merge_request, project: project).to_discussion } let!(:discussion) { create(:diff_note_on_merge_request, noteable: merge_request, project: project).to_discussion }
def resolve_all_discussions_link_selector def resolve_all_discussions_link_selector
text = "Resolve all discussions in new issue" text = "Resolve all threads in new issue"
url = new_project_issue_path(project, merge_request_to_resolve_discussions_of: merge_request.iid) url = new_project_issue_path(project, merge_request_to_resolve_discussions_of: merge_request.iid)
%Q{a[data-original-title="#{text}"][href="#{url}"]} %Q{a[data-original-title="#{text}"][href="#{url}"]}
end end
...@@ -19,15 +19,15 @@ describe 'Resolving all open discussions in a merge request from an issue', :js ...@@ -19,15 +19,15 @@ describe 'Resolving all open discussions in a merge request from an issue', :js
visit project_merge_request_path(project, merge_request) visit project_merge_request_path(project, merge_request)
end end
it 'shows a button to resolve all discussions by creating a new issue' do it 'shows a button to resolve all threads by creating a new issue' do
within('.line-resolve-all-container') do within('.line-resolve-all-container') do
expect(page).to have_selector resolve_all_discussions_link_selector expect(page).to have_selector resolve_all_discussions_link_selector
end end
end end
context 'resolving the discussion' do context 'resolving the thread' do
before do before do
click_button 'Resolve discussion' click_button 'Resolve thread'
end end
it 'hides the link for creating a new issue' do it 'hides the link for creating a new issue' do
...@@ -35,15 +35,15 @@ describe 'Resolving all open discussions in a merge request from an issue', :js ...@@ -35,15 +35,15 @@ describe 'Resolving all open discussions in a merge request from an issue', :js
end end
end end
context 'creating an issue for discussions' do context 'creating an issue for threads' do
before do before do
find(resolve_all_discussions_link_selector).click find(resolve_all_discussions_link_selector).click
end end
it_behaves_like 'creating an issue for a discussion' it_behaves_like 'creating an issue for a thread'
end end
context 'for a project where all discussions need to be resolved before merging' do context 'for a project where all threads need to be resolved before merging' do
before do before do
project.update_attribute(:only_allow_merge_if_all_discussions_are_resolved, true) project.update_attribute(:only_allow_merge_if_all_discussions_are_resolved, true)
end end
...@@ -59,27 +59,27 @@ describe 'Resolving all open discussions in a merge request from an issue', :js ...@@ -59,27 +59,27 @@ describe 'Resolving all open discussions in a merge request from an issue', :js
end end
end end
context 'merge request has discussions that need to be resolved' do context 'merge request has threads that need to be resolved' do
before do before do
visit project_merge_request_path(project, merge_request) visit project_merge_request_path(project, merge_request)
end end
it 'shows a warning that the merge request contains unresolved discussions' do it 'shows a warning that the merge request contains unresolved threads' do
expect(page).to have_content 'There are unresolved discussions.' expect(page).to have_content 'There are unresolved threads.'
end end
it 'has a link to resolve all discussions by creating an issue' do it 'has a link to resolve all threads by creating an issue' do
page.within '.mr-widget-body' do page.within '.mr-widget-body' do
expect(page).to have_link 'Create an issue to resolve them later', href: new_project_issue_path(project, merge_request_to_resolve_discussions_of: merge_request.iid) expect(page).to have_link 'Create an issue to resolve them later', href: new_project_issue_path(project, merge_request_to_resolve_discussions_of: merge_request.iid)
end end
end end
context 'creating an issue for discussions' do context 'creating an issue for threads' do
before do before do
page.click_link 'Create an issue to resolve them later', href: new_project_issue_path(project, merge_request_to_resolve_discussions_of: merge_request.iid) page.click_link 'Create an issue to resolve them later', href: new_project_issue_path(project, merge_request_to_resolve_discussions_of: merge_request.iid)
end end
it_behaves_like 'creating an issue for a discussion' it_behaves_like 'creating an issue for a thread'
end end
end end
end end
...@@ -92,8 +92,8 @@ describe 'Resolving all open discussions in a merge request from an issue', :js ...@@ -92,8 +92,8 @@ describe 'Resolving all open discussions in a merge request from an issue', :js
visit new_project_issue_path(project, merge_request_to_resolve_discussions_of: merge_request.iid) visit new_project_issue_path(project, merge_request_to_resolve_discussions_of: merge_request.iid)
end end
it 'Shows a notice to ask someone else to resolve the discussions' do it 'Shows a notice to ask someone else to resolve the threads' do
expect(page).to have_content("The discussions at #{merge_request.to_reference} will stay unresolved. Ask someone with permission to resolve them.") expect(page).to have_content("The threads at #{merge_request.to_reference} will stay unresolved. Ask someone with permission to resolve them.")
end end
end end
end end
require 'rails_helper' require 'rails_helper'
describe 'Resolve an open discussion in a merge request by creating an issue', :js do describe 'Resolve an open thread in a merge request by creating an issue', :js do
let(:user) { create(:user) } let(:user) { create(:user) }
let(:project) { create(:project, :repository, only_allow_merge_if_all_discussions_are_resolved: true) } let(:project) { create(:project, :repository, only_allow_merge_if_all_discussions_are_resolved: true) }
let(:merge_request) { create(:merge_request, source_project: project) } let(:merge_request) { create(:merge_request, source_project: project) }
let!(:discussion) { create(:diff_note_on_merge_request, noteable: merge_request, project: project).to_discussion } let!(:discussion) { create(:diff_note_on_merge_request, noteable: merge_request, project: project).to_discussion }
def resolve_discussion_selector def resolve_discussion_selector
title = 'Resolve this discussion in a new issue' title = 'Resolve this thread in a new issue'
url = new_project_issue_path(project, discussion_to_resolve: discussion.id, merge_request_to_resolve_discussions_of: merge_request.iid) url = new_project_issue_path(project, discussion_to_resolve: discussion.id, merge_request_to_resolve_discussions_of: merge_request.iid)
"a[data-original-title=\"#{title}\"][href=\"#{url}\"]" "a[data-original-title=\"#{title}\"][href=\"#{url}\"]"
end end
...@@ -30,25 +30,25 @@ describe 'Resolve an open discussion in a merge request by creating an issue', : ...@@ -30,25 +30,25 @@ describe 'Resolve an open discussion in a merge request by creating an issue', :
end end
end end
context 'resolving the discussion' do context 'resolving the thread' do
before do before do
click_button 'Resolve discussion' click_button 'Resolve thread'
end end
it 'hides the link for creating a new issue' do it 'hides the link for creating a new issue' do
expect(page).not_to have_css resolve_discussion_selector expect(page).not_to have_css resolve_discussion_selector
end end
it 'shows the link for creating a new issue when unresolving a discussion' do it 'shows the link for creating a new issue when unresolving a thread' do
page.within '.diff-content' do page.within '.diff-content' do
click_button 'Unresolve discussion' click_button 'Unresolve thread'
end end
expect(page).to have_css resolve_discussion_selector expect(page).to have_css resolve_discussion_selector
end end
end end
it 'has a link to create a new issue for a discussion' do it 'has a link to create a new issue for a thread' do
expect(page).to have_css resolve_discussion_selector expect(page).to have_css resolve_discussion_selector
end end
...@@ -57,13 +57,13 @@ describe 'Resolve an open discussion in a merge request by creating an issue', : ...@@ -57,13 +57,13 @@ describe 'Resolve an open discussion in a merge request by creating an issue', :
find(resolve_discussion_selector, match: :first).click find(resolve_discussion_selector, match: :first).click
end end
it 'has a hidden field for the discussion' do it 'has a hidden field for the thread' do
discussion_field = find('#discussion_to_resolve', visible: false) discussion_field = find('#discussion_to_resolve', visible: false)
expect(discussion_field.value).to eq(discussion.id.to_s) expect(discussion_field.value).to eq(discussion.id.to_s)
end end
it_behaves_like 'creating an issue for a discussion' it_behaves_like 'creating an issue for a thread'
end end
end end
...@@ -75,8 +75,8 @@ describe 'Resolve an open discussion in a merge request by creating an issue', : ...@@ -75,8 +75,8 @@ describe 'Resolve an open discussion in a merge request by creating an issue', :
discussion_to_resolve: discussion.id) discussion_to_resolve: discussion.id)
end end
it 'Shows a notice to ask someone else to resolve the discussions' do it 'Shows a notice to ask someone else to resolve the threads' do
expect(page).to have_content("The discussion at #{merge_request.to_reference}"\ expect(page).to have_content("The thread at #{merge_request.to_reference}"\
" (discussion #{discussion.first_note.id}) will stay unresolved."\ " (discussion #{discussion.first_note.id}) will stay unresolved."\
" Ask someone with permission to resolve it.") " Ask someone with permission to resolve it.")
end end
......
...@@ -37,7 +37,7 @@ describe 'User comments on a merge request', :js do ...@@ -37,7 +37,7 @@ describe 'User comments on a merge request', :js do
wait_for_requests wait_for_requests
page.within('.notes .discussion') do page.within('.notes .discussion') do
expect(page).to have_content("#{user.name} #{user.to_reference} started a discussion") expect(page).to have_content("#{user.name} #{user.to_reference} started a thread")
expect(page).to have_content(sample_commit.line_code_path) expect(page).to have_content(sample_commit.line_code_path)
expect(page).to have_content('Line is wrong') expect(page).to have_content('Line is wrong')
end end
......
require 'rails_helper' require 'rails_helper'
describe 'Merge request > User sees discussions', :js do describe 'Merge request > User sees threads', :js do
let(:project) { create(:project, :public, :repository) } let(:project) { create(:project, :public, :repository) }
let(:user) { project.creator } let(:user) { project.creator }
let(:merge_request) { create(:merge_request, source_project: project) } let(:merge_request) { create(:merge_request, source_project: project) }
...@@ -30,7 +30,7 @@ describe 'Merge request > User sees discussions', :js do ...@@ -30,7 +30,7 @@ describe 'Merge request > User sees discussions', :js do
visit project_merge_request_path(project, merge_request) visit project_merge_request_path(project, merge_request)
end end
context 'active discussions' do context 'active threads' do
it 'shows a link to the diff' do it 'shows a link to the diff' do
within(".discussion[data-discussion-id='#{active_discussion.id}']") do within(".discussion[data-discussion-id='#{active_discussion.id}']") do
path = diffs_project_merge_request_path(project, merge_request, anchor: active_discussion.line_code) path = diffs_project_merge_request_path(project, merge_request, anchor: active_discussion.line_code)
...@@ -39,7 +39,7 @@ describe 'Merge request > User sees discussions', :js do ...@@ -39,7 +39,7 @@ describe 'Merge request > User sees discussions', :js do
end end
end end
context 'outdated discussions' do context 'outdated threads' do
it 'shows a link to the outdated diff' do it 'shows a link to the outdated diff' do
within(".discussion[data-discussion-id='#{outdated_discussion.id}']") do within(".discussion[data-discussion-id='#{outdated_discussion.id}']") do
path = diffs_project_merge_request_path(project, merge_request, diff_id: old_merge_request_diff.id, anchor: outdated_discussion.line_code) path = diffs_project_merge_request_path(project, merge_request, diff_id: old_merge_request_diff.id, anchor: outdated_discussion.line_code)
...@@ -85,7 +85,7 @@ describe 'Merge request > User sees discussions', :js do ...@@ -85,7 +85,7 @@ describe 'Merge request > User sees discussions', :js do
it_behaves_like 'a functional discussion' it_behaves_like 'a functional discussion'
it 'displays correct header' do it 'displays correct header' do
expect(page).to have_content "started a discussion on commit #{note.commit_id[0...7]}" expect(page).to have_content "started a thread on commit #{note.commit_id[0...7]}"
end end
end end
......
require 'rails_helper' require 'rails_helper'
describe 'Merge request > User sees merge button depending on unresolved discussions', :js do describe 'Merge request > User sees merge button depending on unresolved threads', :js do
let(:project) { create(:project, :repository) } let(:project) { create(:project, :repository) }
let(:user) { project.creator } let(:user) { project.creator }
let!(:merge_request) { create(:merge_request_with_diff_notes, source_project: project, author: user) } let!(:merge_request) { create(:merge_request_with_diff_notes, source_project: project, author: user) }
...@@ -16,14 +16,14 @@ describe 'Merge request > User sees merge button depending on unresolved discuss ...@@ -16,14 +16,14 @@ describe 'Merge request > User sees merge button depending on unresolved discuss
visit project_merge_request_path(project, merge_request) visit project_merge_request_path(project, merge_request)
end end
context 'with unresolved discussions' do context 'with unresolved threads' do
it 'does not allow to merge' do it 'does not allow to merge' do
expect(page).not_to have_button 'Merge' expect(page).not_to have_button 'Merge'
expect(page).to have_content('There are unresolved discussions.') expect(page).to have_content('There are unresolved threads.')
end end
end end
context 'with all discussions resolved' do context 'with all threads resolved' do
before do before do
merge_request.discussions.each { |d| d.resolve!(user) } merge_request.discussions.each { |d| d.resolve!(user) }
visit project_merge_request_path(project, merge_request) visit project_merge_request_path(project, merge_request)
...@@ -41,13 +41,13 @@ describe 'Merge request > User sees merge button depending on unresolved discuss ...@@ -41,13 +41,13 @@ describe 'Merge request > User sees merge button depending on unresolved discuss
visit project_merge_request_path(project, merge_request) visit project_merge_request_path(project, merge_request)
end end
context 'with unresolved discussions' do context 'with unresolved threads' do
it 'does not allow to merge' do it 'does not allow to merge' do
expect(page).to have_button 'Merge' expect(page).to have_button 'Merge'
end end
end end
context 'with all discussions resolved' do context 'with all threads resolved' do
before do before do
merge_request.discussions.each { |d| d.resolve!(user) } merge_request.discussions.each { |d| d.resolve!(user) }
visit project_merge_request_path(project, merge_request) visit project_merge_request_path(project, merge_request)
......
...@@ -186,12 +186,12 @@ describe 'User comments on a diff', :js do ...@@ -186,12 +186,12 @@ describe 'User comments on a diff', :js do
it 'resolves discussion when applied' do it 'resolves discussion when applied' do
page.within('.diff-discussions') do page.within('.diff-discussions') do
expect(page).not_to have_content('Unresolve discussion') expect(page).not_to have_content('Unresolve thread')
click_button('Apply suggestion') click_button('Apply suggestion')
wait_for_requests wait_for_requests
expect(page).to have_content('Unresolve discussion') expect(page).to have_content('Unresolve thread')
end end
end end
end end
......
...@@ -45,11 +45,11 @@ describe('noteable_discussion component', () => { ...@@ -45,11 +45,11 @@ describe('noteable_discussion component', () => {
expect(wrapper.find('.user-avatar-link').exists()).toBe(true); expect(wrapper.find('.user-avatar-link').exists()).toBe(true);
}); });
it('should not render discussion header for non diff discussions', () => { it('should not render thread header for non diff threads', () => {
expect(wrapper.find('.discussion-header').exists()).toBe(false); expect(wrapper.find('.discussion-header').exists()).toBe(false);
}); });
it('should render discussion header', done => { it('should render thread header', done => {
const discussion = { ...discussionMock }; const discussion = { ...discussionMock };
discussion.diff_file = mockDiffFile; discussion.diff_file = mockDiffFile;
discussion.diff_discussion = true; discussion.diff_discussion = true;
...@@ -96,16 +96,16 @@ describe('noteable_discussion component', () => { ...@@ -96,16 +96,16 @@ describe('noteable_discussion component', () => {
.catch(done.fail); .catch(done.fail);
}); });
it('does not render jump to discussion button', () => { it('does not render jump to thread button', () => {
expect( expect(wrapper.find('*[data-original-title="Jump to next unresolved thread"]').exists()).toBe(
wrapper.find('*[data-original-title="Jump to next unresolved discussion"]').exists(), false,
).toBe(false); );
}); });
}); });
describe('methods', () => { describe('methods', () => {
describe('jumpToNextDiscussion', () => { describe('jumpToNextDiscussion', () => {
it('expands next unresolved discussion', done => { it('expands next unresolved thread', done => {
const discussion2 = getJSONFixture(discussionWithTwoUnresolvedNotes)[0]; const discussion2 = getJSONFixture(discussionWithTwoUnresolvedNotes)[0];
discussion2.resolved = false; discussion2.resolved = false;
discussion2.active = true; discussion2.active = true;
...@@ -120,9 +120,7 @@ describe('noteable_discussion component', () => { ...@@ -120,9 +120,7 @@ describe('noteable_discussion component', () => {
const nextDiscussionId = discussion2.id; const nextDiscussionId = discussion2.id;
setFixtures(` setFixtures(`<div class="discussion" data-discussion-id="${nextDiscussionId}"></div>`);
<div class="discussion" data-discussion-id="${nextDiscussionId}"></div>
`);
wrapper.vm.jumpToNextDiscussion(); wrapper.vm.jumpToNextDiscussion();
...@@ -168,20 +166,20 @@ describe('noteable_discussion component', () => { ...@@ -168,20 +166,20 @@ describe('noteable_discussion component', () => {
.catch(done.fail); .catch(done.fail);
}); });
describe('for commit discussions', () => { describe('for commit threads', () => {
it('should display a monospace started a discussion on commit', () => { it('should display a monospace started a thread on commit', () => {
expect(wrapper.text()).toContain(`started a discussion on commit ${truncatedCommitId}`); expect(wrapper.text()).toContain(`started a thread on commit ${truncatedCommitId}`);
expect(commitElement.exists()).toBe(true); expect(commitElement.exists()).toBe(true);
expect(commitElement.text()).toContain(truncatedCommitId); expect(commitElement.text()).toContain(truncatedCommitId);
}); });
}); });
describe('for diff discussion with a commit id', () => { describe('for diff thread with a commit id', () => {
it('should display started discussion on commit header', done => { it('should display started thread on commit header', done => {
wrapper.vm.discussion.for_commit = false; wrapper.vm.discussion.for_commit = false;
wrapper.vm.$nextTick(() => { wrapper.vm.$nextTick(() => {
expect(wrapper.text()).toContain(`started a discussion on commit ${truncatedCommitId}`); expect(wrapper.text()).toContain(`started a thread on commit ${truncatedCommitId}`);
expect(commitElement).not.toBe(null); expect(commitElement).not.toBe(null);
...@@ -195,7 +193,7 @@ describe('noteable_discussion component', () => { ...@@ -195,7 +193,7 @@ describe('noteable_discussion component', () => {
wrapper.vm.$nextTick(() => { wrapper.vm.$nextTick(() => {
expect(wrapper.text()).toContain( expect(wrapper.text()).toContain(
`started a discussion on an outdated change in commit ${truncatedCommitId}`, `started a thread on an outdated change in commit ${truncatedCommitId}`,
); );
expect(commitElement).not.toBe(null); expect(commitElement).not.toBe(null);
...@@ -205,21 +203,21 @@ describe('noteable_discussion component', () => { ...@@ -205,21 +203,21 @@ describe('noteable_discussion component', () => {
}); });
}); });
describe('for diff discussions without a commit id', () => { describe('for diff threads without a commit id', () => {
it('should show started a discussion on the diff text', done => { it('should show started a thread on the diff text', done => {
Object.assign(wrapper.vm.discussion, { Object.assign(wrapper.vm.discussion, {
for_commit: false, for_commit: false,
commit_id: null, commit_id: null,
}); });
wrapper.vm.$nextTick(() => { wrapper.vm.$nextTick(() => {
expect(wrapper.text()).toContain('started a discussion on the diff'); expect(wrapper.text()).toContain('started a thread on the diff');
done(); done();
}); });
}); });
it('should show discussion on older version text', done => { it('should show thread on older version text', done => {
Object.assign(wrapper.vm.discussion, { Object.assign(wrapper.vm.discussion, {
for_commit: false, for_commit: false,
commit_id: null, commit_id: null,
...@@ -227,7 +225,7 @@ describe('noteable_discussion component', () => { ...@@ -227,7 +225,7 @@ describe('noteable_discussion component', () => {
}); });
wrapper.vm.$nextTick(() => { wrapper.vm.$nextTick(() => {
expect(wrapper.text()).toContain('started a discussion on an old version of the diff'); expect(wrapper.text()).toContain('started a thread on an old version of the diff');
done(); done();
}); });
...@@ -235,7 +233,7 @@ describe('noteable_discussion component', () => { ...@@ -235,7 +233,7 @@ describe('noteable_discussion component', () => {
}); });
}); });
describe('for resolved discussion', () => { describe('for resolved thread', () => {
beforeEach(() => { beforeEach(() => {
const discussion = getJSONFixture(discussionWithTwoUnresolvedNotes)[0]; const discussion = getJSONFixture(discussionWithTwoUnresolvedNotes)[0];
wrapper.setProps({ discussion }); wrapper.setProps({ discussion });
...@@ -248,7 +246,7 @@ describe('noteable_discussion component', () => { ...@@ -248,7 +246,7 @@ describe('noteable_discussion component', () => {
}); });
}); });
describe('for unresolved discussion', () => { describe('for unresolved thread', () => {
beforeEach(done => { beforeEach(done => {
const discussion = { const discussion = {
...getJSONFixture(discussionWithTwoUnresolvedNotes)[0], ...getJSONFixture(discussionWithTwoUnresolvedNotes)[0],
......
...@@ -10,7 +10,7 @@ describe('UnresolvedDiscussions', () => { ...@@ -10,7 +10,7 @@ describe('UnresolvedDiscussions', () => {
vm.$destroy(); vm.$destroy();
}); });
describe('with discussions path', () => { describe('with threads path', () => {
beforeEach(() => { beforeEach(() => {
vm = mountComponent(Component, { vm = mountComponent(Component, {
mr: { mr: {
...@@ -21,7 +21,7 @@ describe('UnresolvedDiscussions', () => { ...@@ -21,7 +21,7 @@ describe('UnresolvedDiscussions', () => {
it('should have correct elements', () => { it('should have correct elements', () => {
expect(vm.$el.innerText).toContain( expect(vm.$el.innerText).toContain(
'There are unresolved discussions. Please resolve these discussions', 'There are unresolved threads. Please resolve these threads',
); );
expect(vm.$el.innerText).toContain('Create an issue to resolve them later'); expect(vm.$el.innerText).toContain('Create an issue to resolve them later');
...@@ -29,14 +29,14 @@ describe('UnresolvedDiscussions', () => { ...@@ -29,14 +29,14 @@ describe('UnresolvedDiscussions', () => {
}); });
}); });
describe('without discussions path', () => { describe('without threads path', () => {
beforeEach(() => { beforeEach(() => {
vm = mountComponent(Component, { mr: {} }); vm = mountComponent(Component, { mr: {} });
}); });
it('should not show create issue link if user cannot create issue', () => { it('should not show create issue link if user cannot create issue', () => {
expect(vm.$el.innerText).toContain( expect(vm.$el.innerText).toContain(
'There are unresolved discussions. Please resolve these discussions', 'There are unresolved threads. Please resolve these threads',
); );
expect(vm.$el.querySelector('.js-create-issue')).toEqual(null); expect(vm.$el.querySelector('.js-create-issue')).toEqual(null);
......
...@@ -1148,7 +1148,7 @@ describe SystemNoteService do ...@@ -1148,7 +1148,7 @@ describe SystemNoteService do
end end
it 'sets the note text' do it 'sets the note text' do
expect(subject.note).to eq 'resolved all discussions' expect(subject.note).to eq 'resolved all threads'
end end
end end
......
shared_examples 'discussion comments' do |resource_name| shared_examples 'thread comments' do |resource_name|
let(:form_selector) { '.js-main-target-form' } let(:form_selector) { '.js-main-target-form' }
let(:dropdown_selector) { "#{form_selector} .comment-type-dropdown" } let(:dropdown_selector) { "#{form_selector} .comment-type-dropdown" }
let(:toggle_selector) { "#{dropdown_selector} .dropdown-toggle" } let(:toggle_selector) { "#{dropdown_selector} .dropdown-toggle" }
...@@ -48,7 +48,7 @@ shared_examples 'discussion comments' do |resource_name| ...@@ -48,7 +48,7 @@ shared_examples 'discussion comments' do |resource_name|
find(toggle_selector).click find(toggle_selector).click
end end
it 'has a "Comment" item (selected by default) and "Start discussion" item' do it 'has a "Comment" item (selected by default) and "Start thread" item' do
expect(page).to have_selector menu_selector expect(page).to have_selector menu_selector
find("#{menu_selector} li", match: :first) find("#{menu_selector} li", match: :first)
...@@ -59,7 +59,7 @@ shared_examples 'discussion comments' do |resource_name| ...@@ -59,7 +59,7 @@ shared_examples 'discussion comments' do |resource_name|
expect(items.first).to have_selector '.fa-check' expect(items.first).to have_selector '.fa-check'
expect(items.first['class']).to match 'droplab-item-selected' expect(items.first['class']).to match 'droplab-item-selected'
expect(items.last).to have_content 'Start discussion' expect(items.last).to have_content 'Start thread'
expect(items.last).to have_content "Discuss a specific suggestion or question#{' that needs to be resolved' if resource_name == 'merge request'}." expect(items.last).to have_content "Discuss a specific suggestion or question#{' that needs to be resolved' if resource_name == 'merge request'}."
expect(items.last).not_to have_selector '.fa-check' expect(items.last).not_to have_selector '.fa-check'
expect(items.last['class']).not_to match 'droplab-item-selected' expect(items.last['class']).not_to match 'droplab-item-selected'
...@@ -103,7 +103,7 @@ shared_examples 'discussion comments' do |resource_name| ...@@ -103,7 +103,7 @@ shared_examples 'discussion comments' do |resource_name|
expect(find(dropdown_selector)).to have_content 'Comment' expect(find(dropdown_selector)).to have_content 'Comment'
end end
describe 'when selecting "Start discussion"' do describe 'when selecting "Start thread"' do
before do before do
find("#{menu_selector} li", match: :first) find("#{menu_selector} li", match: :first)
all("#{menu_selector} li").last.click all("#{menu_selector} li").last.click
...@@ -114,9 +114,9 @@ shared_examples 'discussion comments' do |resource_name| ...@@ -114,9 +114,9 @@ shared_examples 'discussion comments' do |resource_name|
# on issues page, the submit input is a <button>, on other pages it is <input> # on issues page, the submit input is a <button>, on other pages it is <input>
if button.tag_name == 'button' if button.tag_name == 'button'
expect(find(submit_selector)).to have_content 'Start discussion' expect(find(submit_selector)).to have_content 'Start thread'
else else
expect(find(submit_selector).value).to eq 'Start discussion' expect(find(submit_selector).value).to eq 'Start thread'
end end
expect(page).not_to have_selector menu_selector expect(page).not_to have_selector menu_selector
...@@ -124,17 +124,17 @@ shared_examples 'discussion comments' do |resource_name| ...@@ -124,17 +124,17 @@ shared_examples 'discussion comments' do |resource_name|
if resource_name =~ /(issue|merge request)/ if resource_name =~ /(issue|merge request)/
it 'updates the close button text' do it 'updates the close button text' do
expect(find(close_selector)).to have_content "Start discussion & close #{resource_name}" expect(find(close_selector)).to have_content "Start thread & close #{resource_name}"
end end
it 'typing does not change the close button text' do it 'typing does not change the close button text' do
find("#{form_selector} .note-textarea").send_keys('b') find("#{form_selector} .note-textarea").send_keys('b')
expect(find(close_selector)).to have_content "Start discussion & close #{resource_name}" expect(find(close_selector)).to have_content "Start thread & close #{resource_name}"
end end
end end
describe 'creating a discussion' do describe 'creating a thread' do
before do before do
find(submit_selector).click find(submit_selector).click
wait_for_requests wait_for_requests
...@@ -150,7 +150,7 @@ shared_examples 'discussion comments' do |resource_name| ...@@ -150,7 +150,7 @@ shared_examples 'discussion comments' do |resource_name|
wait_for_requests wait_for_requests
end end
it 'clicking "Start discussion" will post a discussion' do it 'clicking "Start thread" will post a thread' do
new_comment = all(comments_selector).last new_comment = all(comments_selector).last
expect(new_comment).to have_content 'a' expect(new_comment).to have_content 'a'
...@@ -179,7 +179,7 @@ shared_examples 'discussion comments' do |resource_name| ...@@ -179,7 +179,7 @@ shared_examples 'discussion comments' do |resource_name|
let(:reply_id) { find("#{comments_selector} .note:last-of-type", match: :first)['data-note-id'] } let(:reply_id) { find("#{comments_selector} .note:last-of-type", match: :first)['data-note-id'] }
it 'can be replied to after resolving' do it 'can be replied to after resolving' do
click_button "Resolve discussion" click_button "Resolve thread"
wait_for_requests wait_for_requests
refresh refresh
...@@ -188,10 +188,10 @@ shared_examples 'discussion comments' do |resource_name| ...@@ -188,10 +188,10 @@ shared_examples 'discussion comments' do |resource_name|
submit_reply('to reply or not reply') submit_reply('to reply or not reply')
end end
it 'shows resolved discussion when toggled' do it 'shows resolved thread when toggled' do
submit_reply('a') submit_reply('a')
click_button "Resolve discussion" click_button "Resolve thread"
wait_for_requests wait_for_requests
expect(page).to have_selector(".note-row-#{note_id}", visible: true) expect(page).to have_selector(".note-row-#{note_id}", visible: true)
...@@ -205,7 +205,7 @@ shared_examples 'discussion comments' do |resource_name| ...@@ -205,7 +205,7 @@ shared_examples 'discussion comments' do |resource_name|
end end
if resource_name == 'issue' if resource_name == 'issue'
it "clicking 'Start discussion & close #{resource_name}' will post a discussion and close the #{resource_name}" do it "clicking 'Start thread & close #{resource_name}' will post a thread and close the #{resource_name}" do
find(close_selector).click find(close_selector).click
find(comments_selector, match: :first) find(comments_selector, match: :first)
...@@ -224,7 +224,7 @@ shared_examples 'discussion comments' do |resource_name| ...@@ -224,7 +224,7 @@ shared_examples 'discussion comments' do |resource_name|
find(toggle_selector).click find(toggle_selector).click
end end
it 'has "Start discussion" selected' do it 'has "Start thread" selected' do
find("#{menu_selector} li", match: :first) find("#{menu_selector} li", match: :first)
items = all("#{menu_selector} li") items = all("#{menu_selector} li")
...@@ -232,7 +232,7 @@ shared_examples 'discussion comments' do |resource_name| ...@@ -232,7 +232,7 @@ shared_examples 'discussion comments' do |resource_name|
expect(items.first).not_to have_selector '.fa-check' expect(items.first).not_to have_selector '.fa-check'
expect(items.first['class']).not_to match 'droplab-item-selected' expect(items.first['class']).not_to match 'droplab-item-selected'
expect(items.last).to have_content 'Start discussion' expect(items.last).to have_content 'Start thread'
expect(items.last).to have_selector '.fa-check' expect(items.last).to have_selector '.fa-check'
expect(items.last['class']).to match 'droplab-item-selected' expect(items.last['class']).to match 'droplab-item-selected'
end end
...@@ -277,7 +277,7 @@ shared_examples 'discussion comments' do |resource_name| ...@@ -277,7 +277,7 @@ shared_examples 'discussion comments' do |resource_name|
expect(items.first).to have_selector '.fa-check' expect(items.first).to have_selector '.fa-check'
expect(items.first['class']).to match 'droplab-item-selected' expect(items.first['class']).to match 'droplab-item-selected'
expect(items.last).to have_content 'Start discussion' expect(items.last).to have_content 'Start thread'
expect(items.last).not_to have_selector '.fa-check' expect(items.last).not_to have_selector '.fa-check'
expect(items.last['class']).not_to match 'droplab-item-selected' expect(items.last['class']).not_to match 'droplab-item-selected'
end end
...@@ -299,13 +299,13 @@ shared_examples 'discussion comments' do |resource_name| ...@@ -299,13 +299,13 @@ shared_examples 'discussion comments' do |resource_name|
expect(find("#{form_selector} .js-note-target-reopen")).to have_content "Comment & reopen #{resource_name}" expect(find("#{form_selector} .js-note-target-reopen")).to have_content "Comment & reopen #{resource_name}"
end end
it "should show a 'Start discussion & reopen #{resource_name}' button when 'Start discussion' is selected" do it "should show a 'Start thread & reopen #{resource_name}' button when 'Start thread' is selected" do
find(toggle_selector).click find(toggle_selector).click
find("#{menu_selector} li", match: :first) find("#{menu_selector} li", match: :first)
all("#{menu_selector} li").last.click all("#{menu_selector} li").last.click
expect(find("#{form_selector} .js-note-target-reopen")).to have_content "Start discussion & reopen #{resource_name}" expect(find("#{form_selector} .js-note-target-reopen")).to have_content "Start thread & reopen #{resource_name}"
end end
end end
end end
......
shared_examples 'creating an issue for a discussion' do shared_examples 'creating an issue for a thread' do
it 'shows an issue with the title filled in' do it 'shows an issue with the title filled in' do
title_field = page.find_field('issue[title]') title_field = page.find_field('issue[title]')
......
...@@ -16,7 +16,7 @@ shared_examples 'comment on merge request file' do ...@@ -16,7 +16,7 @@ shared_examples 'comment on merge request file' do
visit(merge_request_path(merge_request)) visit(merge_request_path(merge_request))
page.within('.notes .discussion') do page.within('.notes .discussion') do
expect(page).to have_content("#{user.name} #{user.to_reference} started a discussion") expect(page).to have_content("#{user.name} #{user.to_reference} started a thread")
expect(page).to have_content(sample_commit.line_code_path) expect(page).to have_content(sample_commit.line_code_path)
expect(page).to have_content('Line is wrong') expect(page).to have_content('Line is wrong')
end end
......
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