Commit 40df9a8a authored by GitLab Bot's avatar GitLab Bot

Automatic merge of gitlab-org/gitlab master

parents 3339b689 632b7768
...@@ -14,6 +14,10 @@ function sanitize(str) { ...@@ -14,6 +14,10 @@ function sanitize(str) {
return str.replace(/<(?:.|\n)*?>/gm, ''); return str.replace(/<(?:.|\n)*?>/gm, '');
} }
function createMemberSearchString(member) {
return `${member.name.replace(/ /g, '')} ${member.username}`;
}
export function membersBeforeSave(members) { export function membersBeforeSave(members) {
return members.map((member) => { return members.map((member) => {
const GROUP_TYPE = 'Group'; const GROUP_TYPE = 'Group';
...@@ -40,7 +44,7 @@ export function membersBeforeSave(members) { ...@@ -40,7 +44,7 @@ export function membersBeforeSave(members) {
username: member.username, username: member.username,
avatarTag: autoCompleteAvatar.length === 1 ? txtAvatar : imgAvatar, avatarTag: autoCompleteAvatar.length === 1 ? txtAvatar : imgAvatar,
title: sanitize(title), title: sanitize(title),
search: sanitize(`${member.username} ${member.name}`), search: sanitize(createMemberSearchString(member)),
icon: avatarIcon, icon: avatarIcon,
availability: member?.availability, availability: member?.availability,
}; };
...@@ -298,9 +302,7 @@ class GfmAutoComplete { ...@@ -298,9 +302,7 @@ class GfmAutoComplete {
// Cache assignees list for easier filtering later // Cache assignees list for easier filtering later
assignees = assignees =
SidebarMediator.singleton?.store?.assignees?.map( SidebarMediator.singleton?.store?.assignees?.map(createMemberSearchString) || [];
(assignee) => `${assignee.username} ${assignee.name}`,
) || [];
const match = GfmAutoComplete.defaultMatcher(flag, subtext, this.app.controllers); const match = GfmAutoComplete.defaultMatcher(flag, subtext, this.app.controllers);
return match && match.length ? match[1] : null; return match && match.length ? match[1] : null;
......
...@@ -126,8 +126,9 @@ export default class Project { ...@@ -126,8 +126,9 @@ export default class Project {
const refs = this.fullData.Branches.concat(this.fullData.Tags); const refs = this.fullData.Branches.concat(this.fullData.Tags);
const currentRef = refs.find((ref) => loc.indexOf(ref) > -1); const currentRef = refs.find((ref) => loc.indexOf(ref) > -1);
if (currentRef) { if (currentRef) {
const targetPath = loc.split(currentRef)[1].slice(1); const targetPath = loc.split(currentRef)[1].slice(1).split('#')[0];
selectedUrl.searchParams.set('path', targetPath); selectedUrl.searchParams.set('path', targetPath);
selectedUrl.hash = window.location.hash;
} }
} }
......
...@@ -105,7 +105,7 @@ class Projects::IssuesController < Projects::ApplicationController ...@@ -105,7 +105,7 @@ class Projects::IssuesController < Projects::ApplicationController
build_params = issue_create_params.merge( build_params = issue_create_params.merge(
merge_request_to_resolve_discussions_of: params[:merge_request_to_resolve_discussions_of], merge_request_to_resolve_discussions_of: params[:merge_request_to_resolve_discussions_of],
discussion_to_resolve: params[:discussion_to_resolve], discussion_to_resolve: params[:discussion_to_resolve],
confidential: !!Gitlab::Utils.to_boolean(params[:issue][:confidential]) confidential: !!Gitlab::Utils.to_boolean(issue_create_params[:confidential])
) )
service = ::Issues::BuildService.new(project, current_user, build_params) service = ::Issues::BuildService.new(project, current_user, build_params)
......
---
title: Fix bug branch change with line selected
merge_request: 52285
author:
type: fixed
---
title: Search across full name for mentions autocomplete
merge_request: 52488
author:
type: added
---
title: Issues created from Vulnerabilities set to Confidential by default
merge_request: 52127
author:
type: changed
...@@ -69,11 +69,19 @@ RSpec.describe Projects::IssuesController do ...@@ -69,11 +69,19 @@ RSpec.describe Projects::IssuesController do
let(:vulnerability) { create(:vulnerability, project: project, findings: [finding]) } let(:vulnerability) { create(:vulnerability, project: project, findings: [finding]) }
let(:vulnerability_field) { "<input type=\"hidden\" name=\"vulnerability_id\" id=\"vulnerability_id\" value=\"#{vulnerability.id}\" />" } let(:vulnerability_field) { "<input type=\"hidden\" name=\"vulnerability_id\" id=\"vulnerability_id\" value=\"#{vulnerability.id}\" />" }
subject { get :new, params: { namespace_id: project.namespace, project_id: project, vulnerability_id: vulnerability.id } }
it 'sets the vulnerability_id' do it 'sets the vulnerability_id' do
get :new, params: { namespace_id: project.namespace, project_id: project, vulnerability_id: vulnerability.id } subject
expect(response.body).to include(vulnerability_field) expect(response.body).to include(vulnerability_field)
end end
it 'sets the confidential flag to true by default' do
subject
expect(assigns(:issue).confidential).to eq(true)
end
end end
end end
......
...@@ -183,6 +183,16 @@ RSpec.describe 'GFM autocomplete', :js do ...@@ -183,6 +183,16 @@ RSpec.describe 'GFM autocomplete', :js do
expect(find('#at-view-users')).to have_content(user.name) expect(find('#at-view-users')).to have_content(user.name)
end end
it 'searches across full name for assignees' do
page.within '.timeline-content-form' do
find('#note-body').native.send_keys('@speciąlsome')
end
wait_for_requests
expect(find('.atwho-view li', visible: true)).to have_content(user.name)
end
it 'selects the first item for non-assignee dropdowns if a query is entered' do it 'selects the first item for non-assignee dropdowns if a query is entered' do
page.within '.timeline-content-form' do page.within '.timeline-content-form' do
find('#note-body').native.send_keys(':1') find('#note-body').native.send_keys(':1')
......
...@@ -493,7 +493,7 @@ describe('GfmAutoComplete', () => { ...@@ -493,7 +493,7 @@ describe('GfmAutoComplete', () => {
username: 'my-group', username: 'my-group',
avatarTag: '<div class="avatar rect-avatar center avatar-inline s26">M</div>', avatarTag: '<div class="avatar rect-avatar center avatar-inline s26">M</div>',
title: 'My Group (2)', title: 'My Group (2)',
search: 'my-group My Group', search: 'MyGroup my-group',
icon: '', icon: '',
}, },
]); ]);
...@@ -506,7 +506,7 @@ describe('GfmAutoComplete', () => { ...@@ -506,7 +506,7 @@ describe('GfmAutoComplete', () => {
avatarTag: avatarTag:
'<img src="./group.jpg" alt="my-group" class="avatar rect-avatar avatar-inline center s26"/>', '<img src="./group.jpg" alt="my-group" class="avatar rect-avatar avatar-inline center s26"/>',
title: 'My Group (2)', title: 'My Group (2)',
search: 'my-group My Group', search: 'MyGroup my-group',
icon: '', icon: '',
}, },
]); ]);
...@@ -519,7 +519,7 @@ describe('GfmAutoComplete', () => { ...@@ -519,7 +519,7 @@ describe('GfmAutoComplete', () => {
avatarTag: avatarTag:
'<img src="./group.jpg" alt="my-group" class="avatar rect-avatar avatar-inline center s26"/>', '<img src="./group.jpg" alt="my-group" class="avatar rect-avatar avatar-inline center s26"/>',
title: 'My Group', title: 'My Group',
search: 'my-group My Group', search: 'MyGroup my-group',
icon: icon:
'<svg class="s16 vertical-align-middle gl-ml-2"><use xlink:href="undefined#notifications-off" /></svg>', '<svg class="s16 vertical-align-middle gl-ml-2"><use xlink:href="undefined#notifications-off" /></svg>',
}, },
...@@ -537,7 +537,7 @@ describe('GfmAutoComplete', () => { ...@@ -537,7 +537,7 @@ describe('GfmAutoComplete', () => {
avatarTag: avatarTag:
'<img src="./users.jpg" alt="my-user" class="avatar avatar-inline center s26"/>', '<img src="./users.jpg" alt="my-user" class="avatar avatar-inline center s26"/>',
title: 'My User', title: 'My User',
search: 'my-user My User', search: 'MyUser my-user',
icon: '', icon: '',
}, },
]); ]);
......
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