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
0a2cd584
Commit
0a2cd584
authored
Sep 16, 2021
by
Dheeraj Joshi
Committed by
Enrique Alcántara
Sep 16, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Prevent escaping names in bot popovers
parent
1141506d
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
19 additions
and
2 deletions
+19
-2
app/assets/javascripts/vue_shared/components/user_popover/user_popover.vue
...ripts/vue_shared/components/user_popover/user_popover.vue
+12
-2
spec/frontend/vue_shared/components/user_popover/user_popover_spec.js
...d/vue_shared/components/user_popover/user_popover_spec.js
+7
-0
No files found.
app/assets/javascripts/vue_shared/components/user_popover/user_popover.vue
View file @
0a2cd584
<
script
>
<
script
>
import
{
GlPopover
,
GlLink
,
GlSkeletonLoader
,
GlIcon
,
GlSafeHtmlDirective
}
from
'
@gitlab/ui
'
;
import
{
GlPopover
,
GlLink
,
GlSkeletonLoader
,
GlIcon
,
GlSafeHtmlDirective
,
GlSprintf
,
}
from
'
@gitlab/ui
'
;
import
UserNameWithStatus
from
'
~/sidebar/components/assignees/user_name_with_status.vue
'
;
import
UserNameWithStatus
from
'
~/sidebar/components/assignees/user_name_with_status.vue
'
;
import
{
glEmojiTag
}
from
'
../../../emoji
'
;
import
{
glEmojiTag
}
from
'
../../../emoji
'
;
import
UserAvatarImage
from
'
../user_avatar/user_avatar_image.vue
'
;
import
UserAvatarImage
from
'
../user_avatar/user_avatar_image.vue
'
;
...
@@ -16,6 +23,7 @@ export default {
...
@@ -16,6 +23,7 @@ export default {
GlSkeletonLoader
,
GlSkeletonLoader
,
UserAvatarImage
,
UserAvatarImage
,
UserNameWithStatus
,
UserNameWithStatus
,
GlSprintf
,
},
},
directives
:
{
directives
:
{
SafeHtml
:
GlSafeHtmlDirective
,
SafeHtml
:
GlSafeHtmlDirective
,
...
@@ -103,7 +111,9 @@ export default {
...
@@ -103,7 +111,9 @@ export default {
<div
v-if=
"user.bot"
class=
"gl-text-blue-500"
>
<div
v-if=
"user.bot"
class=
"gl-text-blue-500"
>
<gl-icon
name=
"question"
/>
<gl-icon
name=
"question"
/>
<gl-link
data-testid=
"user-popover-bot-docs-link"
:href=
"user.websiteUrl"
>
<gl-link
data-testid=
"user-popover-bot-docs-link"
:href=
"user.websiteUrl"
>
{{
sprintf
(
__
(
'
Learn more about %{username
}
'
),
{
username
:
user
.
name
}
)
}}
<gl-sprintf
:message=
"__('Learn more about %
{username}')">
<template
#username
>
{{
user
.
name
}}
</
template
>
</gl-sprintf>
</gl-link>
</gl-link>
</div>
</div>
</template>
</template>
...
...
spec/frontend/vue_shared/components/user_popover/user_popover_spec.js
View file @
0a2cd584
...
@@ -248,6 +248,13 @@ describe('User Popover Component', () => {
...
@@ -248,6 +248,13 @@ describe('User Popover Component', () => {
const
securityBotDocsLink
=
findSecurityBotDocsLink
();
const
securityBotDocsLink
=
findSecurityBotDocsLink
();
expect
(
securityBotDocsLink
.
exists
()).
toBe
(
true
);
expect
(
securityBotDocsLink
.
exists
()).
toBe
(
true
);
expect
(
securityBotDocsLink
.
attributes
(
'
href
'
)).
toBe
(
SECURITY_BOT_USER
.
websiteUrl
);
expect
(
securityBotDocsLink
.
attributes
(
'
href
'
)).
toBe
(
SECURITY_BOT_USER
.
websiteUrl
);
expect
(
securityBotDocsLink
.
text
()).
toBe
(
'
Learn more about GitLab Security Bot
'
);
});
it
(
"
doesn't escape user's name
"
,
()
=>
{
createWrapper
({
user
:
{
...
SECURITY_BOT_USER
,
name
:
'
%<>
\'
;"
'
}
});
const
securityBotDocsLink
=
findSecurityBotDocsLink
();
expect
(
securityBotDocsLink
.
text
()).
toBe
(
'
Learn more about %<>
\'
;"
'
);
});
});
});
});
});
});
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