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