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) {
return str.replace(/<(?:.|\n)*?>/gm, '');
}
function createMemberSearchString(member) {
return `${member.name.replace(/ /g, '')} ${member.username}`;
}
export function membersBeforeSave(members) {
return members.map((member) => {
const GROUP_TYPE = 'Group';
......@@ -40,7 +44,7 @@ export function membersBeforeSave(members) {
username: member.username,
avatarTag: autoCompleteAvatar.length === 1 ? txtAvatar : imgAvatar,
title: sanitize(title),
search: sanitize(`${member.username} ${member.name}`),
search: sanitize(createMemberSearchString(member)),
icon: avatarIcon,
availability: member?.availability,
};
......@@ -298,9 +302,7 @@ class GfmAutoComplete {
// Cache assignees list for easier filtering later
assignees =
SidebarMediator.singleton?.store?.assignees?.map(
(assignee) => `${assignee.username} ${assignee.name}`,
) || [];
SidebarMediator.singleton?.store?.assignees?.map(createMemberSearchString) || [];
const match = GfmAutoComplete.defaultMatcher(flag, subtext, this.app.controllers);
return match && match.length ? match[1] : null;
......
......@@ -126,8 +126,9 @@ export default class Project {
const refs = this.fullData.Branches.concat(this.fullData.Tags);
const currentRef = refs.find((ref) => loc.indexOf(ref) > -1);
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.hash = window.location.hash;
}
}
......
......@@ -105,7 +105,7 @@ class Projects::IssuesController < Projects::ApplicationController
build_params = issue_create_params.merge(
merge_request_to_resolve_discussions_of: params[:merge_request_to_resolve_discussions_of],
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)
......
---
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
let(:vulnerability) { create(:vulnerability, project: project, findings: [finding]) }
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
get :new, params: { namespace_id: project.namespace, project_id: project, vulnerability_id: vulnerability.id }
subject
expect(response.body).to include(vulnerability_field)
end
it 'sets the confidential flag to true by default' do
subject
expect(assigns(:issue).confidential).to eq(true)
end
end
end
......
......@@ -183,6 +183,16 @@ RSpec.describe 'GFM autocomplete', :js do
expect(find('#at-view-users')).to have_content(user.name)
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
page.within '.timeline-content-form' do
find('#note-body').native.send_keys(':1')
......
......@@ -493,7 +493,7 @@ describe('GfmAutoComplete', () => {
username: 'my-group',
avatarTag: '<div class="avatar rect-avatar center avatar-inline s26">M</div>',
title: 'My Group (2)',
search: 'my-group My Group',
search: 'MyGroup my-group',
icon: '',
},
]);
......@@ -506,7 +506,7 @@ describe('GfmAutoComplete', () => {
avatarTag:
'<img src="./group.jpg" alt="my-group" class="avatar rect-avatar avatar-inline center s26"/>',
title: 'My Group (2)',
search: 'my-group My Group',
search: 'MyGroup my-group',
icon: '',
},
]);
......@@ -519,7 +519,7 @@ describe('GfmAutoComplete', () => {
avatarTag:
'<img src="./group.jpg" alt="my-group" class="avatar rect-avatar avatar-inline center s26"/>',
title: 'My Group',
search: 'my-group My Group',
search: 'MyGroup my-group',
icon:
'<svg class="s16 vertical-align-middle gl-ml-2"><use xlink:href="undefined#notifications-off" /></svg>',
},
......@@ -537,7 +537,7 @@ describe('GfmAutoComplete', () => {
avatarTag:
'<img src="./users.jpg" alt="my-user" class="avatar avatar-inline center s26"/>',
title: 'My User',
search: 'my-user My User',
search: 'MyUser my-user',
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