Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
6c199005
Commit
6c199005
authored
Mar 04, 2019
by
Ezekiel Kigbo
Committed by
Fatih Acet
Mar 04, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix username escaping when clicking 'assign to me'
Add spec for assigning user with apostrophe in name
parent
b64e261b
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
36 additions
and
14 deletions
+36
-14
app/assets/javascripts/users_select.js
app/assets/javascripts/users_select.js
+13
-14
changelogs/unreleased/37673-minor-issue-with-apostrophe-single-quote-when-clicking-assign-to-me.yml
...th-apostrophe-single-quote-when-clicking-assign-to-me.yml
+5
-0
spec/features/issues/user_creates_issue_spec.rb
spec/features/issues/user_creates_issue_spec.rb
+18
-0
No files found.
app/assets/javascripts/users_select.js
View file @
6c199005
...
...
@@ -93,23 +93,22 @@ function UsersSelect(currentUser, els, options = {}) {
}
// Save current selected user to the DOM
const
input
=
document
.
createElement
(
'
input
'
);
input
.
type
=
'
hidden
'
;
input
.
name
=
$dropdown
.
data
(
'
fieldName
'
);
const
currentUserInfo
=
$dropdown
.
data
(
'
currentUserInfo
'
);
if
(
currentUserInfo
)
{
input
.
value
=
currentUserInfo
.
id
;
input
.
dataset
.
meta
=
_
.
escape
(
currentUserInfo
.
name
);
}
else
if
(
_this
.
currentUser
)
{
input
.
value
=
_this
.
currentUser
.
id
;
}
const
currentUserInfo
=
$dropdown
.
data
(
'
currentUserInfo
'
)
||
{};
const
currentUser
=
_this
.
currentUser
||
{};
const
fieldName
=
$dropdown
.
data
(
'
fieldName
'
);
const
userName
=
currentUserInfo
.
name
;
const
userId
=
currentUserInfo
.
id
||
currentUser
.
id
;
const
inputHtmlString
=
_
.
template
(
`
<input type="hidden" name="<%- fieldName %>"
data-meta="<%- userName %>"
value="<%- userId %>" />
`
)({
fieldName
,
userName
,
userId
});
if
(
$selectbox
)
{
$dropdown
.
parent
().
before
(
input
);
$dropdown
.
parent
().
before
(
input
HtmlString
);
}
else
{
$dropdown
.
after
(
input
);
$dropdown
.
after
(
input
HtmlString
);
}
};
...
...
changelogs/unreleased/37673-minor-issue-with-apostrophe-single-quote-when-clicking-assign-to-me.yml
0 → 100644
View file @
6c199005
---
title
:
Fix username escaping when using assign to me for issues
merge_request
:
24673
author
:
type
:
fixed
spec/features/issues/user_creates_issue_spec.rb
View file @
6c199005
...
...
@@ -93,4 +93,22 @@ describe "User creates issue" do
end
end
end
context
"when signed in as user with special characters in their name"
do
let
(
:user_special
)
{
create
(
:user
,
name:
"Jon O'Shea"
)
}
before
do
project
.
add_developer
(
user_special
)
sign_in
(
user_special
)
visit
(
new_project_issue_path
(
project
))
end
it
"will correctly escape user names with an apostrophe when clicking 'Assign to me'"
,
:js
do
first
(
'.assign-to-me-link'
).
click
expect
(
page
).
to
have_content
(
user_special
.
name
)
expect
(
page
.
find
(
'input[name="issue[assignee_ids][]"]'
,
visible:
false
)[
'data-meta'
]).
to
eq
(
user_special
.
name
)
end
end
end
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment