Commit 1d013ee9 authored by Filipa Lacerda's avatar Filipa Lacerda

Merge branch...

Merge branch '27067-mention-user-dropdown-does-not-suggest-by-non-ascii-characters-in-name' into 'master'

Resolve "Mention @user dropdown does not suggest by non-ASCII characters in name"

Closes #27067

See merge request !8729
parents 4d3011f3 80ad1c62
...@@ -83,12 +83,12 @@ ...@@ -83,12 +83,12 @@
_a = decodeURI("%C3%80"); _a = decodeURI("%C3%80");
_y = decodeURI("%C3%BF"); _y = decodeURI("%C3%BF");
regexp = new RegExp("^(?:\\B|[^a-zA-Z0-9_" + atSymbolsWithoutBar + "]|\\s)" + flag + "(?![" + atSymbolsWithBar + "])([A-Za-z" + _a + "-" + _y + "0-9_\'\.\+\-]*)$", 'gi'); regexp = new RegExp("^(?:\\B|[^a-zA-Z0-9_" + atSymbolsWithoutBar + "]|\\s)" + flag + "(?![" + atSymbolsWithBar + "])(([A-Za-z" + _a + "-" + _y + "0-9_\'\.\+\-]|[^\\x00-\\x7a])*)$", 'gi');
match = regexp.exec(subtext); match = regexp.exec(subtext);
if (match) { if (match) {
return match[2] || match[1]; return (match[1] || match[1] === "") ? match[1] : match[2];
} else { } else {
return null; return null;
} }
......
---
title: Support non-ASCII characters in GFM autocomplete
merge_request: 8729
author:
...@@ -2,7 +2,7 @@ require 'rails_helper' ...@@ -2,7 +2,7 @@ require 'rails_helper'
feature 'GFM autocomplete', feature: true, js: true do feature 'GFM autocomplete', feature: true, js: true do
include WaitForAjax include WaitForAjax
let(:user) { create(:user, username: 'someone.special') } let(:user) { create(:user, name: '💃speciąl someone💃', username: 'someone.special') }
let(:project) { create(:project) } let(:project) { create(:project) }
let(:label) { create(:label, project: project, title: 'special+') } let(:label) { create(:label, project: project, title: 'special+') }
let(:issue) { create(:issue, project: project) } let(:issue) { create(:issue, project: project) }
...@@ -59,6 +59,19 @@ feature 'GFM autocomplete', feature: true, js: true do ...@@ -59,6 +59,19 @@ feature 'GFM autocomplete', feature: true, js: true do
expect(find('#at-view-64')).to have_selector('.cur:first-of-type') expect(find('#at-view-64')).to have_selector('.cur:first-of-type')
end end
it 'includes items for assignee dropdowns with non-ASCII characters in name' do
page.within '.timeline-content-form' do
find('#note_note').native.send_keys('')
find('#note_note').native.send_keys("@#{user.name[0...8]}")
end
expect(page).to have_selector('.atwho-container')
wait_for_ajax
expect(find('#at-view-64')).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_note').native.send_keys('') find('#note_note').native.send_keys('')
......
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