Commit 36258668 authored by Magdalena Frankiewicz's avatar Magdalena Frankiewicz

Do not show bot docs link in popover if URL is missing

parent b627a22a
......@@ -116,7 +116,7 @@ export default {
<div v-if="statusHtml" class="gl-mb-2" data-testid="user-popover-status">
<span v-safe-html:[$options.safeHtmlConfig]="statusHtml"></span>
</div>
<div v-if="user.bot" class="gl-text-blue-500">
<div v-if="user.bot && user.websiteUrl" class="gl-text-blue-500">
<gl-icon name="question" />
<gl-link data-testid="user-popover-bot-docs-link" :href="user.websiteUrl">
<gl-sprintf :message="__('Learn more about %{username}')">
......
......@@ -271,6 +271,12 @@ describe('User Popover Component', () => {
expect(securityBotDocsLink.text()).toBe('Learn more about GitLab Security Bot');
});
it("does not show a link to the bot's documentation if there is no website_url", () => {
createWrapper({ user: { ...SECURITY_BOT_USER, websiteUrl: null } });
const securityBotDocsLink = findSecurityBotDocsLink();
expect(securityBotDocsLink.exists()).toBe(false);
});
it("doesn't escape user's name", () => {
createWrapper({ user: { ...SECURITY_BOT_USER, name: '%<>\';"' } });
const securityBotDocsLink = findSecurityBotDocsLink();
......
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