Commit 628cc3c8 authored by Lukas Eipert's avatar Lukas Eipert

Remove unnecessary aliasing of escape and unescape

See https://gitlab.com/gitlab-org/gitlab/-/issues/205390 for reference.
parent e42010c7
......@@ -6,7 +6,7 @@ import {
GlModal,
GlModalDirective,
} from '@gitlab/ui';
import { escape as esc } from 'lodash';
import { escape } from 'lodash';
import ClipboardButton from '~/vue_shared/components/clipboard_button.vue';
import ToggleButton from '~/vue_shared/components/toggle_button.vue';
import axios from '~/lib/utils/axios_utils';
......@@ -65,7 +65,7 @@ export default {
'AlertService|%{linkStart}Learn more%{linkEnd} about configuring this endpoint to receive alerts.',
),
{
linkStart: `<a href="${esc(
linkStart: `<a href="${escape(
this.learnMoreUrl,
)}" target="_blank" rel="noopener noreferrer">`,
linkEnd: '</a>',
......
/* eslint-disable class-methods-use-this */
import { Mark } from 'tiptap';
import { escape as esc } from 'lodash';
import { escape } from 'lodash';
// Transforms generated HTML back to GFM for Banzai::Filter::MarkdownFilter
export default class InlineHTML extends Mark {
......@@ -35,7 +35,7 @@ export default class InlineHTML extends Mark {
mixable: true,
open(state, mark) {
return `<${mark.attrs.tag}${
mark.attrs.title ? ` title="${state.esc(esc(mark.attrs.title))}"` : ''
mark.attrs.title ? ` title="${state.esc(escape(mark.attrs.title))}"` : ''
}>`;
},
close(state, mark) {
......
import { escape as esc } from 'lodash';
import { escape } from 'lodash';
import axios from '../lib/utils/axios_utils';
import { s__ } from '../locale';
import Flash from '../flash';
......@@ -10,7 +10,7 @@ function generateErrorBoxContent(errors) {
const errorList = [].concat(errors).map(
errorString => `
<li>
${esc(errorString)}
${escape(errorString)}
</li>
`,
);
......
<script>
import { escape as esc } from 'lodash';
import { escape } from 'lodash';
import helmInstallIllustration from '@gitlab/svgs/dist/illustrations/kubernetes-installation.svg';
import { GlLoadingIcon } from '@gitlab/ui';
import elasticsearchLogo from 'images/cluster_app_logos/elasticsearch.png';
......@@ -138,7 +138,7 @@ export default {
},
ingressDescription() {
return sprintf(
esc(
escape(
s__(
`ClusterIntegration|Installing Ingress may incur additional costs. Learn more about %{pricingLink}.`,
),
......@@ -146,14 +146,14 @@ export default {
{
pricingLink: `<a href="https://cloud.google.com/compute/pricing#lb"
target="_blank" rel="noopener noreferrer">
${esc(s__('ClusterIntegration|pricing'))}</a>`,
${escape(s__('ClusterIntegration|pricing'))}</a>`,
},
false,
);
},
certManagerDescription() {
return sprintf(
esc(
escape(
s__(
`ClusterIntegration|Cert-Manager is a native Kubernetes certificate management controller that helps with issuing certificates.
Installing Cert-Manager on your cluster will issue a certificate by %{letsEncrypt} and ensure that certificates
......@@ -163,14 +163,14 @@ export default {
{
letsEncrypt: `<a href="https://letsencrypt.org/"
target="_blank" rel="noopener noreferrer">
${esc(s__("ClusterIntegration|Let's Encrypt"))}</a>`,
${escape(s__("ClusterIntegration|Let's Encrypt"))}</a>`,
},
false,
);
},
crossplaneDescription() {
return sprintf(
esc(
escape(
s__(
`ClusterIntegration|Crossplane enables declarative provisioning of managed services from your cloud of choice using %{kubectl} or %{gitlabIntegrationLink}.
Crossplane runs inside your Kubernetes cluster and supports secure connectivity and secrets management between app containers and the cloud services they depend on.`,
......@@ -179,7 +179,7 @@ Crossplane runs inside your Kubernetes cluster and supports secure connectivity
{
gitlabIntegrationLink: `<a href="https://docs.gitlab.com/ee/user/clusters/applications.html#crossplane"
target="_blank" rel="noopener noreferrer">
${esc(s__('ClusterIntegration|Gitlab Integration'))}</a>`,
${escape(s__('ClusterIntegration|Gitlab Integration'))}</a>`,
kubectl: `<code>kubectl</code>`,
},
false,
......@@ -188,7 +188,7 @@ Crossplane runs inside your Kubernetes cluster and supports secure connectivity
prometheusDescription() {
return sprintf(
esc(
escape(
s__(
`ClusterIntegration|Prometheus is an open-source monitoring system
with %{gitlabIntegrationLink} to monitor deployed applications.`,
......@@ -197,7 +197,7 @@ Crossplane runs inside your Kubernetes cluster and supports secure connectivity
{
gitlabIntegrationLink: `<a href="https://docs.gitlab.com/ce/user/project/integrations/prometheus.html"
target="_blank" rel="noopener noreferrer">
${esc(s__('ClusterIntegration|GitLab Integration'))}</a>`,
${escape(s__('ClusterIntegration|GitLab Integration'))}</a>`,
},
false,
);
......@@ -223,11 +223,11 @@ Crossplane runs inside your Kubernetes cluster and supports secure connectivity
installedVia() {
if (this.cloudRun) {
return sprintf(
esc(s__(`ClusterIntegration|installed via %{installed_via}`)),
escape(s__(`ClusterIntegration|installed via %{installed_via}`)),
{
installed_via: `<a href="${
this.cloudRunHelpPath
}" target="_blank" rel="noopener noreferrer">${esc(
}" target="_blank" rel="noopener noreferrer">${escape(
s__('ClusterIntegration|Cloud Run'),
)}</a>`,
},
......
<script>
import { escape as esc } from 'lodash';
import { escape } from 'lodash';
import { s__, __ } from '../../locale';
import { APPLICATION_STATUS, INGRESS, LOGGING_MODE, BLOCKING_MODE } from '~/clusters/constants';
import {
......@@ -87,7 +87,7 @@ export default {
);
},
ingressModSecurityDescription() {
return esc(this.ingressModSecurityHelpPath);
return escape(this.ingressModSecurityHelpPath);
},
saving() {
return [UPDATING].includes(this.ingress.status);
......
<script>
import { escape as esc } from 'lodash';
import { escape } from 'lodash';
import SplitButton from '~/vue_shared/components/split_button.vue';
import { GlModal, GlDeprecatedButton, GlFormInput } from '@gitlab/ui';
import { s__, sprintf } from '~/locale';
......@@ -82,7 +82,7 @@ export default {
)
: s__('ClusterIntegration|To remove your integration, type %{clusterName} to confirm:'),
{
clusterName: `<code>${esc(this.clusterName)}</code>`,
clusterName: `<code>${escape(this.clusterName)}</code>`,
},
false,
);
......
<script>
import { createNamespacedHelpers, mapState, mapActions, mapGetters } from 'vuex';
import { escape as esc } from 'lodash';
import { escape } from 'lodash';
import { GlFormInput, GlFormCheckbox } from '@gitlab/ui';
import { sprintf, s__ } from '~/locale';
import ClusterFormDropdown from '~/create_cluster/components/cluster_form_dropdown.vue';
......@@ -137,7 +137,7 @@ export default {
: s__('ClusterIntegration|Create Kubernetes cluster');
},
kubernetesIntegrationHelpText() {
const escapedUrl = esc(this.kubernetesIntegrationHelpPath);
const escapedUrl = escape(this.kubernetesIntegrationHelpPath);
return sprintf(
s__(
......@@ -256,7 +256,7 @@ export default {
);
},
gitlabManagedHelpText() {
const escapedUrl = esc(this.gitlabManagedClusterHelpPath);
const escapedUrl = escape(this.gitlabManagedClusterHelpPath);
return sprintf(
s__(
......
<script>
import { GlFormInput } from '@gitlab/ui';
import { escape as esc } from 'lodash';
import { escape } from 'lodash';
import { mapState, mapActions } from 'vuex';
import { sprintf, s__, __ } from '~/locale';
import ClipboardButton from '~/vue_shared/components/clipboard_button.vue';
......@@ -42,7 +42,7 @@ export default {
: s__('ClusterIntegration|Authenticate with AWS');
},
accountAndExternalIdsHelpText() {
const escapedUrl = esc(this.accountAndExternalIdsHelpPath);
const escapedUrl = escape(this.accountAndExternalIdsHelpPath);
return sprintf(
s__(
......@@ -59,7 +59,7 @@ export default {
);
},
provisionRoleArnHelpText() {
const escapedUrl = esc(this.createRoleArnHelpPath);
const escapedUrl = escape(this.createRoleArnHelpPath);
return sprintf(
s__(
......
<script>
import { escape as esc } from 'lodash';
import { escape } from 'lodash';
import { mapState, mapGetters, mapActions } from 'vuex';
import { s__, sprintf } from '~/locale';
......@@ -65,7 +65,7 @@ export default {
s__(message),
{
docsLinkEnd: '&nbsp;<i class="fa fa-external-link" aria-hidden="true"></i></a>',
docsLinkStart: `<a href="${esc(
docsLinkStart: `<a href="${escape(
this.docsUrl,
)}" target="_blank" rel="noopener noreferrer">`,
},
......
import { escape as esc } from 'lodash';
import { escape } from 'lodash';
import '~/gl_dropdown';
export default class CreateItemDropdown {
......@@ -37,14 +37,14 @@ export default class CreateItemDropdown {
},
selectable: true,
toggleLabel(selected) {
return selected && 'id' in selected ? esc(selected.title) : this.defaultToggleLabel;
return selected && 'id' in selected ? escape(selected.title) : this.defaultToggleLabel;
},
fieldName: this.fieldName,
text(item) {
return esc(item.text);
return escape(item.text);
},
id(item) {
return esc(item.id);
return escape(item.id);
},
onFilter: this.toggleCreateNewButton.bind(this),
clicked: options => {
......
<script>
import { mapActions, mapGetters, mapState } from 'vuex';
import { escape as esc } from 'lodash';
import { escape } from 'lodash';
import { GlLoadingIcon } from '@gitlab/ui';
import { __, sprintf } from '~/locale';
import createFlash from '~/flash';
......@@ -46,7 +46,7 @@ export default {
return sprintf(
__('You can %{linkStart}view the blob%{linkEnd} instead.'),
{
linkStart: `<a href="${esc(this.file.view_path)}">`,
linkStart: `<a href="${escape(this.file.view_path)}">`,
linkEnd: '</a>',
},
false,
......
<script>
import { escape as esc } from 'lodash';
import { escape } from 'lodash';
import { mapActions, mapGetters } from 'vuex';
import { GlDeprecatedButton, GlTooltipDirective, GlLoadingIcon } from '@gitlab/ui';
import { polyfillSticky } from '~/lib/utils/sticky';
......@@ -91,7 +91,7 @@ export default {
return this.expanded ? 'chevron-down' : 'chevron-right';
},
viewFileButtonText() {
const truncatedContentSha = esc(truncateSha(this.diffFile.content_sha));
const truncatedContentSha = escape(truncateSha(this.diffFile.content_sha));
return sprintf(
s__('MergeRequests|View file @ %{commitId}'),
{ commitId: truncatedContentSha },
......@@ -99,7 +99,7 @@ export default {
);
},
viewReplacedFileButtonText() {
const truncatedBaseSha = esc(truncateSha(this.diffFile.diff_refs.base_sha));
const truncatedBaseSha = escape(truncateSha(this.diffFile.diff_refs.base_sha));
return sprintf(
s__('MergeRequests|View replaced file @ %{commitId}'),
{
......
<script>
import { mapGetters } from 'vuex';
import { escape as esc } from 'lodash';
import { escape } from 'lodash';
import { GlDeprecatedButton } from '@gitlab/ui';
import { __, sprintf } from '~/locale';
......@@ -24,8 +24,8 @@ export default {
{
ref_start: '<span class="ref-name">',
ref_end: '</span>',
source_branch: esc(this.getNoteableData.source_branch),
target_branch: esc(this.getNoteableData.target_branch),
source_branch: escape(this.getNoteableData.source_branch),
target_branch: escape(this.getNoteableData.target_branch),
},
false,
);
......
import $ from 'jquery';
import Dropzone from 'dropzone';
import { escape as esc } from 'lodash';
import { escape } from 'lodash';
import './behaviors/preview_markdown';
import PasteMarkdownTable from './behaviors/markdown/paste_markdown_table';
import csrf from './lib/utils/csrf';
......@@ -233,7 +233,7 @@ export default function dropzoneInput(form, config = { parallelUploads: 2 }) {
};
addFileToForm = path => {
$(form).append(`<input type="hidden" name="files[]" value="${esc(path)}">`);
$(form).append(`<input type="hidden" name="files[]" value="${escape(path)}">`);
};
const showSpinner = () => $uploadingProgressContainer.removeClass('hide');
......
......@@ -3,7 +3,7 @@
* Render modal to confirm rollback/redeploy.
*/
import { escape as esc } from 'lodash';
import { escape } from 'lodash';
import { GlModal } from '@gitlab/ui';
import { s__, sprintf } from '~/locale';
......@@ -30,7 +30,7 @@ export default {
: s__('Environments|Rollback environment %{name}?');
return sprintf(title, {
name: esc(this.environment.name),
name: escape(this.environment.name),
});
},
......@@ -50,10 +50,10 @@ export default {
},
modalText() {
const linkStart = `<a class="commit-sha mr-0" href="${esc(this.commitUrl)}">`;
const commitId = esc(this.commitShortSha);
const linkStart = `<a class="commit-sha mr-0" href="${escape(this.commitUrl)}">`;
const commitId = escape(this.commitShortSha);
const linkEnd = '</a>';
const name = esc(this.name);
const name = escape(this.name);
const body = this.environment.isLastDeployment
? s__(
'Environments|This action will relaunch the job for commit %{linkStart}%{commitId}%{linkEnd}, putting the environment in a previous version. Are you sure you want to continue?',
......
<script>
import { escape as esc } from 'lodash';
import { escape } from 'lodash';
import { GlTooltip } from '@gitlab/ui';
import { __, sprintf } from '~/locale';
import ClipboardButton from '~/vue_shared/components/clipboard_button.vue';
......@@ -62,7 +62,7 @@ export default {
? sprintf(
__(`%{spanStart}in%{spanEnd} %{errorFn}`),
{
errorFn: `<strong>${esc(this.errorFn)}</strong>`,
errorFn: `<strong>${escape(this.errorFn)}</strong>`,
spanStart: `<span class="text-tertiary">`,
spanEnd: `</span>`,
},
......
import { escape as esc } from 'lodash';
import { escape } from 'lodash';
import { USER_TOKEN_TYPES } from 'ee_else_ce/filtered_search/constants';
import FilteredSearchContainer from '~/filtered_search/container';
import FilteredSearchVisualTokens from '~/filtered_search/filtered_search_visual_tokens';
......@@ -48,7 +48,7 @@ export default class VisualTokenValue {
tokenValueContainer.dataset.originalValue = tokenValue;
tokenValueElement.innerHTML = `
<img class="avatar s20" src="${user.avatar_url}" alt="">
${esc(user.name)}
${escape(user.name)}
`;
/* eslint-enable no-param-reassign */
})
......
import { escape as esc } from 'lodash';
import { escape } from 'lodash';
import { spriteIcon } from './lib/utils/common_utils';
const FLASH_TYPES = {
......@@ -39,14 +39,14 @@ const createAction = config => `
class="flash-action"
${config.href ? '' : 'role="button"'}
>
${esc(config.title)}
${escape(config.title)}
</a>
`;
const createFlashEl = (message, type) => `
<div class="flash-${type}">
<div class="flash-text">
${esc(message)}
${escape(message)}
<div class="close-icon-wrapper js-close-icon">
${spriteIcon('close', 'close-icon')}
</div>
......
import $ from 'jquery';
import '@gitlab/at.js';
import { escape as esc, template } from 'lodash';
import { escape, template } from 'lodash';
import SidebarMediator from '~/sidebar/sidebar_mediator';
import glRegexp from './lib/utils/regexp';
import AjaxCache from './lib/utils/ajax_cache';
......@@ -692,14 +692,14 @@ GfmAutoComplete.Emoji = {
// Team Members
GfmAutoComplete.Members = {
templateFunction({ avatarTag, username, title, icon }) {
return `<li>${avatarTag} ${username} <small>${esc(title)}</small> ${icon}</li>`;
return `<li>${avatarTag} ${username} <small>${escape(title)}</small> ${icon}</li>`;
},
};
GfmAutoComplete.Labels = {
templateFunction(color, title) {
return `<li><span class="dropdown-label-box" style="background: ${esc(color)}"></span> ${esc(
title,
)}</li>`;
return `<li><span class="dropdown-label-box" style="background: ${escape(
color,
)}"></span> ${escape(title)}</li>`;
},
};
// Issues, MergeRequests and Snippets
......@@ -709,13 +709,13 @@ GfmAutoComplete.Issues = {
return value.reference || '${atwho-at}${id}';
},
templateFunction({ id, title, reference }) {
return `<li><small>${reference || id}</small> ${esc(title)}</li>`;
return `<li><small>${reference || id}</small> ${escape(title)}</li>`;
},
};
// Milestones
GfmAutoComplete.Milestones = {
templateFunction(title) {
return `<li>${esc(title)}</li>`;
return `<li>${escape(title)}</li>`;
},
};
GfmAutoComplete.Loading = {
......
/* eslint-disable max-classes-per-file, one-var, consistent-return */
import $ from 'jquery';
import { escape as esc } from 'lodash';
import { escape } from 'lodash';
import fuzzaldrinPlus from 'fuzzaldrin-plus';
import axios from './lib/utils/axios_utils';
import { visitUrl } from './lib/utils/url_utility';
......@@ -610,7 +610,7 @@ class GitLabDropdown {
// eslint-disable-next-line class-methods-use-this
highlightTemplate(text, template) {
return `"<b>${esc(text)}</b>" ${template}`;
return `"<b>${escape(text)}</b>" ${template}`;
}
// eslint-disable-next-line class-methods-use-this
......
<script>
import { escape as esc } from 'lodash';
import { escape } from 'lodash';
import { mapState, mapGetters, createNamespacedHelpers } from 'vuex';
import { sprintf, s__ } from '~/locale';
import consts from '../../stores/modules/commit/constants';
......@@ -22,7 +22,7 @@ export default {
commitToCurrentBranchText() {
return sprintf(
s__('IDE|Commit to %{branchName} branch'),
{ branchName: `<strong class="monospace">${esc(this.currentBranchId)}</strong>` },
{ branchName: `<strong class="monospace">${escape(this.currentBranchId)}</strong>` },
false,
);
},
......
<script>
import { mapActions, mapGetters, mapState } from 'vuex';
import { escape as esc } from 'lodash';
import { escape } from 'lodash';
import { GlLoadingIcon } from '@gitlab/ui';
import { sprintf, __ } from '../../../locale';
import Icon from '../../../vue_shared/components/icon.vue';
......@@ -35,7 +35,7 @@ export default {
return sprintf(
__('You can test your .gitlab-ci.yml in %{linkStart}CI Lint%{linkEnd}.'),
{
linkStart: `<a href="${esc(this.currentProject.web_url)}/-/ci/lint">`,
linkStart: `<a href="${escape(this.currentProject.web_url)}/-/ci/lint">`,
linkEnd: '</a>',
},
false,
......
import $ from 'jquery';
import Vue from 'vue';
import { escape as esc } from 'lodash';
import { escape } from 'lodash';
import { __, sprintf } from '~/locale';
import { visitUrl } from '~/lib/utils/url_utility';
import flash from '~/flash';
......@@ -296,7 +296,7 @@ export const getBranchData = ({ commit, state }, { projectId, branchId, force =
sprintf(
__('Branch not loaded - %{branchId}'),
{
branchId: `<strong>${esc(projectId)}/${esc(branchId)}</strong>`,
branchId: `<strong>${escape(projectId)}/${escape(branchId)}</strong>`,
},
false,
),
......
import { escape as esc } from 'lodash';
import { escape } from 'lodash';
import flash from '~/flash';
import { __, sprintf } from '~/locale';
import service from '../../services';
......@@ -73,7 +73,7 @@ export const showBranchNotFoundError = ({ dispatch }, branchId) => {
text: sprintf(
__("Branch %{branchName} was not found in this project's repository."),
{
branchName: `<strong>${esc(branchId)}</strong>`,
branchName: `<strong>${escape(branchId)}</strong>`,
},
false,
),
......@@ -162,7 +162,7 @@ export const openBranch = ({ dispatch }, { projectId, branchId, basePath }) => {
sprintf(
__('An error occurred while getting files for - %{branchId}'),
{
branchId: `<strong>${esc(projectId)}/${esc(branchId)}</strong>`,
branchId: `<strong>${escape(projectId)}/${escape(branchId)}</strong>`,
},
false,
),
......
import $ from 'jquery';
import { escape as esc } from 'lodash';
import { escape } from 'lodash';
import { __, sprintf } from './locale';
import axios from './lib/utils/axios_utils';
import flash from './flash';
......@@ -73,9 +73,9 @@ class ImporterStatus {
const connectingVerb = this.ciCdOnly ? __('connecting') : __('importing');
job.find('.import-actions').html(
sprintf(
esc(__('%{loadingIcon} Started')),
escape(__('%{loadingIcon} Started')),
{
loadingIcon: `<i class="fa fa-spinner fa-spin" aria-label="${esc(
loadingIcon: `<i class="fa fa-spinner fa-spin" aria-label="${escape(
connectingVerb,
)}"></i>`,
},
......
<script>
import { escape as esc, isEmpty } from 'lodash';
import { escape, isEmpty } from 'lodash';
import CiIcon from '~/vue_shared/components/ci_icon.vue';
import { sprintf, __ } from '../../locale';
......@@ -43,7 +43,7 @@ export default {
'%{startLink}%{name}%{endLink}',
{
startLink: `<a href="${this.deploymentStatus.environment.environment_path}" class="js-environment-link">`,
name: esc(this.deploymentStatus.environment.name),
name: escape(this.deploymentStatus.environment.name),
endLink: '</a>',
},
false,
......@@ -74,8 +74,8 @@ export default {
}
const { name, path } = this.deploymentCluster;
const escapedName = esc(name);
const escapedPath = esc(path);
const escapedName = escape(name);
const escapedPath = escape(path);
if (!escapedPath) {
return escapedName;
......
......@@ -3,7 +3,7 @@
/* global ListLabel */
import $ from 'jquery';
import { isEqual, escape as esc, sortBy, template } from 'lodash';
import { isEqual, escape, sortBy, template } from 'lodash';
import { sprintf, s__, __ } from './locale';
import axios from './lib/utils/axios_utils';
import IssuableBulkUpdateActions from './issuable_bulk_update_actions';
......@@ -269,7 +269,7 @@ export default class LabelsSelect {
}
linkEl.className = selectedClass.join(' ');
linkEl.innerHTML = `${colorEl} ${esc(label.title)}`;
linkEl.innerHTML = `${colorEl} ${escape(label.title)}`;
const listItemEl = document.createElement('li');
listItemEl.appendChild(linkEl);
......@@ -557,7 +557,7 @@ export default class LabelsSelect {
scopedLabelTemplate,
tooltipTitleTemplate,
isScopedLabel,
escapeStr: esc,
escapeStr: escape,
});
}
......
......@@ -3,7 +3,7 @@
/* global ListMilestone */
import $ from 'jquery';
import { template, escape as esc } from 'lodash';
import { template, escape } from 'lodash';
import { __ } from '~/locale';
import '~/gl_dropdown';
import axios from './lib/utils/axios_utils';
......@@ -106,12 +106,12 @@ export default class MilestoneSelect {
if (showMenuAbove) {
$dropdown.data('glDropdown').positionMenuAbove();
}
$(`[data-milestone-id="${esc(selectedMilestone)}"] > a`).addClass('is-active');
$(`[data-milestone-id="${escape(selectedMilestone)}"] > a`).addClass('is-active');
}),
renderRow: milestone => `
<li data-milestone-id="${esc(milestone.name)}">
<li data-milestone-id="${escape(milestone.name)}">
<a href='#' class='dropdown-menu-milestone-link'>
${esc(milestone.title)}
${escape(milestone.title)}
</a>
</li>
`,
......@@ -129,7 +129,7 @@ export default class MilestoneSelect {
},
defaultLabel,
fieldName: $dropdown.data('fieldName'),
text: milestone => esc(milestone.title),
text: milestone => escape(milestone.title),
id: milestone => {
if (!useId && !$dropdown.is('.js-issuable-form-dropdown')) {
return milestone.name;
......@@ -148,7 +148,7 @@ export default class MilestoneSelect {
selectedMilestone = $dropdown[0].dataset.selected || selectedMilestoneDefault;
}
$('a.is-active', $el).removeClass('is-active');
$(`[data-milestone-id="${esc(selectedMilestone)}"] > a`, $el).addClass('is-active');
$(`[data-milestone-id="${escape(selectedMilestone)}"] > a`, $el).addClass('is-active');
},
vue: $dropdown.hasClass('js-issue-board-sidebar'),
clicked: clickEvent => {
......
import $ from 'jquery';
import { escape as esc } from 'lodash';
import { escape } from 'lodash';
import { __ } from '~/locale';
import axios from '~/lib/utils/axios_utils';
import Flash from '~/flash';
......@@ -161,7 +161,7 @@ export default class SSHMirror {
const $fingerprintsList = this.$hostKeysInformation.find('.js-fingerprints-list');
let fingerprints = '';
sshHostKeys.fingerprints.forEach(fingerprint => {
const escFingerprints = esc(fingerprint.fingerprint);
const escFingerprints = escape(fingerprint.fingerprint);
fingerprints += `<code>${escFingerprints}</code>`;
});
......
<script>
import { escape as esc } from 'lodash';
import { escape } from 'lodash';
import DeprecatedModal from '~/vue_shared/components/deprecated_modal.vue';
import { s__, sprintf } from '~/locale';
......@@ -34,7 +34,7 @@ export default {
return sprintf(
s__('AdminProjects|Delete Project %{projectName}?'),
{
projectName: `'${esc(this.projectName)}'`,
projectName: `'${escape(this.projectName)}'`,
},
false,
);
......@@ -46,7 +46,7 @@ export default {
and all related resources including issues, merge requests, etc.. Once you confirm and press
%{strong_start}Delete project%{strong_end}, it cannot be undone or recovered.`),
{
projectName: `<strong>${esc(this.projectName)}</strong>`,
projectName: `<strong>${escape(this.projectName)}</strong>`,
strong_start: '<strong>',
strong_end: '</strong>',
},
......@@ -57,7 +57,7 @@ export default {
return sprintf(
s__('AdminUsers|To confirm, type %{projectName}'),
{
projectName: `<code>${esc(this.projectName)}</code>`,
projectName: `<code>${escape(this.projectName)}</code>`,
},
false,
);
......
<script>
import { escape as esc } from 'lodash';
import { escape } from 'lodash';
import { GlModal, GlDeprecatedButton, GlFormInput } from '@gitlab/ui';
import { s__, sprintf } from '~/locale';
......@@ -56,7 +56,7 @@ export default {
return sprintf(
this.content,
{
username: `<strong>${esc(this.username)}</strong>`,
username: `<strong>${escape(this.username)}</strong>`,
strong_start: '<strong>',
strong_end: '</strong>',
},
......@@ -67,7 +67,7 @@ export default {
return sprintf(
s__('AdminUsers|To confirm, type %{username}'),
{
username: `<code>${esc(this.username)}</code>`,
username: `<code>${escape(this.username)}</code>`,
},
false,
);
......
<script>
import { escape as esc } from 'lodash';
import { escape } from 'lodash';
import axios from '~/lib/utils/axios_utils';
import createFlash from '~/flash';
import DeprecatedModal2 from '~/vue_shared/components/deprecated_modal_2.vue';
......@@ -49,7 +49,7 @@ export default {
const label = `<span
class="label color-label"
style="background-color: ${this.labelColor}; color: ${this.labelTextColor};"
>${esc(this.labelTitle)}</span>`;
>${escape(this.labelTitle)}</span>`;
return sprintf(
s__('Labels|<span>Promote label</span> %{labelTitle} <span>to Group Label?</span>'),
......
<script>
import { escape as esc } from 'lodash';
import { escape } from 'lodash';
import { GlModal, GlModalDirective } from '@gitlab/ui';
import { s__, sprintf } from '~/locale';
......@@ -38,7 +38,7 @@ export default {
return sprintf(
s__('WikiPageConfirmDelete|Delete page %{pageTitle}?'),
{
pageTitle: esc(this.pageTitle),
pageTitle: escape(this.pageTitle),
},
false,
);
......
<script>
import { isEmpty, escape as esc } from 'lodash';
import { isEmpty, escape } from 'lodash';
import stageColumnMixin from '../../mixins/stage_column_mixin';
import JobItem from './job_item.vue';
import JobGroupDropdown from './job_group_dropdown.vue';
......@@ -44,7 +44,7 @@ export default {
},
methods: {
groupId(group) {
return `ci-badge-${esc(group.name)}`;
return `ci-badge-${escape(group.name)}`;
},
pipelineActionRequestComplete() {
this.$emit('refreshPipelineGraph');
......
<script>
import { escape as esc } from 'lodash';
import { escape } from 'lodash';
import axios from '~/lib/utils/axios_utils';
import DeprecatedModal2 from '~/vue_shared/components/deprecated_modal_2.vue';
import { s__, sprintf } from '~/locale';
......@@ -43,10 +43,10 @@ You are going to change the username %{currentUsernameBold} to %{newUsernameBold
Profile and projects will be redirected to the %{newUsername} namespace but this redirect will expire once the %{currentUsername} namespace is registered by another user or group.
Please update your Git repository remotes as soon as possible.`),
{
currentUsernameBold: `<strong>${esc(this.username)}</strong>`,
newUsernameBold: `<strong>${esc(this.newUsername)}</strong>`,
currentUsername: esc(this.username),
newUsername: esc(this.newUsername),
currentUsernameBold: `<strong>${escape(this.username)}</strong>`,
newUsernameBold: `<strong>${escape(this.newUsername)}</strong>`,
currentUsername: escape(this.username),
newUsername: escape(this.newUsername),
},
false,
);
......
<script>
import { mapState, mapActions, mapGetters } from 'vuex';
import { GlButton, GlFormInput, GlFormGroup } from '@gitlab/ui';
import { escape as esc } from 'lodash';
import { escape } from 'lodash';
import { __, sprintf } from '~/locale';
import MarkdownField from '~/vue_shared/components/markdown/field.vue';
import autofocusonshow from '~/vue_shared/directives/autofocusonshow';
......@@ -58,7 +58,7 @@ export default {
'Changing a Release tag is only supported via Releases API. %{linkStart}More information%{linkEnd}',
),
{
linkStart: `<a href="${esc(
linkStart: `<a href="${escape(
this.updateReleaseApiDocsPath,
)}" target="_blank" rel="noopener noreferrer">`,
linkEnd: '</a>',
......
/* eslint-disable no-return-assign, consistent-return, class-methods-use-this */
import $ from 'jquery';
import { escape as esc, throttle } from 'lodash';
import { escape, throttle } from 'lodash';
import { s__, __ } from '~/locale';
import { getIdenticonBackgroundClass, getIdenticonTitle } from '~/helpers/avatar_helper';
import axios from './lib/utils/axios_utils';
......@@ -448,7 +448,7 @@ export class SearchAutocomplete {
const avatar = avatarUrl
? `<img class="search-item-avatar" src="${avatarUrl}" />`
: `<div class="s16 avatar identicon ${getIdenticonBackgroundClass(id)}">${getIdenticonTitle(
esc(label),
escape(label),
)}</div>`;
return avatar;
......
import $ from 'jquery';
import '~/gl_dropdown';
import { escape as esc } from 'lodash';
import { escape } from 'lodash';
import { __ } from '~/locale';
function isValidProjectId(id) {
......@@ -49,7 +49,7 @@ class SidebarMoveIssue {
renderRow: project => `
<li>
<a href="#" class="js-move-issue-dropdown-item">
${esc(project.name_with_namespace)}
${escape(project.name_with_namespace)}
</a>
</li>
`,
......
......@@ -3,7 +3,7 @@
/* global emitSidebarEvent */
import $ from 'jquery';
import { escape as esc, template, uniqBy } from 'lodash';
import { escape, template, uniqBy } from 'lodash';
import axios from './lib/utils/axios_utils';
import { s__, __, sprintf } from './locale';
import ModalStore from './boards/stores/modal_store';
......@@ -205,7 +205,7 @@ function UsersSelect(currentUser, els, options = {}) {
username: data.assignee.username,
avatar: data.assignee.avatar_url,
};
tooltipTitle = esc(user.name);
tooltipTitle = escape(user.name);
} else {
user = {
name: s__('UsersSelect|Unassigned'),
......@@ -543,7 +543,7 @@ function UsersSelect(currentUser, els, options = {}) {
let img = '';
if (user.beforeDivider != null) {
`<li><a href='#' class='${selected === true ? 'is-active' : ''}'>${esc(
`<li><a href='#' class='${selected === true ? 'is-active' : ''}'>${escape(
user.name,
)}</a></li>`;
} else {
......@@ -672,10 +672,10 @@ UsersSelect.prototype.formatResult = function(user) {
</div>
<div class='user-info'>
<div class='user-name dropdown-menu-user-full-name'>
${esc(user.name)}
${escape(user.name)}
</div>
<div class='user-username dropdown-menu-user-username text-secondary'>
${!user.invite ? `@${esc(user.username)}` : ''}
${!user.invite ? `@${escape(user.username)}` : ''}
</div>
</div>
</div>
......@@ -683,7 +683,7 @@ UsersSelect.prototype.formatResult = function(user) {
};
UsersSelect.prototype.formatSelection = function(user) {
return esc(user.name);
return escape(user.name);
};
UsersSelect.prototype.user = function(user_id, callback) {
......@@ -746,7 +746,7 @@ UsersSelect.prototype.renderRow = function(issuableType, user, selected, usernam
${this.renderRowAvatar(issuableType, user, img)}
<span class="d-flex flex-column overflow-hidden">
<strong class="dropdown-menu-user-full-name">
${esc(user.name)}
${escape(user.name)}
</strong>
${username ? `<span class="dropdown-menu-user-username">${username}</span>` : ''}
</span>
......
<script>
import { escape as esc } from 'lodash';
import { escape } from 'lodash';
import { n__, s__, sprintf } from '~/locale';
import { mergeUrlParams, webIDEUrl } from '~/lib/utils/url_utility';
import Icon from '~/vue_shared/components/icon.vue';
......@@ -35,7 +35,7 @@ export default {
'mrWidget|The source branch is %{commitsBehindLinkStart}%{commitsBehind}%{commitsBehindLinkEnd} the target branch',
),
{
commitsBehindLinkStart: `<a href="${esc(this.mr.targetBranchPath)}">`,
commitsBehindLinkStart: `<a href="${escape(this.mr.targetBranchPath)}">`,
commitsBehind: n__('%d commit behind', '%d commits behind', this.mr.divergedCommitsCount),
commitsBehindLinkEnd: '</a>',
},
......
<script>
import { GlDeprecatedButton } from '@gitlab/ui';
import { escape as esc } from 'lodash';
import { escape } from 'lodash';
import { __, n__, sprintf, s__ } from '~/locale';
import Icon from '~/vue_shared/components/icon.vue';
......@@ -60,7 +60,7 @@ export default {
{
commitCount: `<strong class="commits-count-message">${this.commitsCountMessage}</strong>`,
mergeCommitCount: `<strong>${s__('mrWidgetCommitsAdded|1 merge commit')}</strong>`,
targetBranch: `<span class="label-branch">${esc(this.targetBranch)}</span>`,
targetBranch: `<span class="label-branch">${escape(this.targetBranch)}</span>`,
},
false,
);
......
<script>
import $ from 'jquery';
import { escape as esc } from 'lodash';
import { escape } from 'lodash';
import { s__, sprintf } from '~/locale';
import { mouseenter, debouncedMouseleave, togglePopover } from '~/shared/popover';
import StatusIcon from '../mr_widget_status_icon.vue';
......@@ -50,7 +50,7 @@ export default {
content: sprintf(
s__('mrWidget|%{link_start}Learn more about resolving conflicts%{link_end}'),
{
link_start: `<a href="${esc(
link_start: `<a href="${escape(
this.mr.conflictsDocsPath,
)}" target="_blank" rel="noopener noreferrer">`,
link_end: '</a>',
......
<script>
import { GlLink } from '@gitlab/ui';
import { escape as esc } from 'lodash';
import { escape } from 'lodash';
import { __, sprintf } from '~/locale';
import icon from '../../../vue_shared/components/icon.vue';
function buildDocsLinkStart(path) {
return `<a href="${esc(path)}" target="_blank" rel="noopener noreferrer">`;
return `<a href="${escape(path)}" target="_blank" rel="noopener noreferrer">`;
}
export default {
......
<script>
import $ from 'jquery';
import '~/behaviors/markdown/render_gfm';
import { unescape as unesc } from 'lodash';
import { unescape } from 'lodash';
import { __, sprintf } from '~/locale';
import { stripHtml } from '~/lib/utils/text_utility';
import Flash from '../../../flash';
......@@ -115,7 +115,7 @@ export default {
return text;
}
return unesc(stripHtml(richText).replace(/\n/g, ''));
return unescape(stripHtml(richText).replace(/\n/g, ''));
}
return '';
......
<script>
import { escape as esc } from 'lodash';
import { escape } from 'lodash';
import { mapState } from 'vuex';
import { __, sprintf, n__ } from '~/locale';
import { getTimeago } from '~/lib/utils/datetime_utility';
......@@ -25,7 +25,7 @@ export default {
methods: {
getTimeAgoString(createdAt) {
return sprintf(__('opened %{timeAgo}'), {
timeAgo: esc(getTimeago().format(createdAt)),
timeAgo: escape(getTimeago().format(createdAt)),
});
},
showReviewTime(value) {
......
<script>
import $ from 'jquery';
import { escape as esc } from 'lodash';
import { escape } from 'lodash';
import { GlDeprecatedButton } from '@gitlab/ui';
import { sprintf, s__ } from '~/locale';
import Icon from '~/vue_shared/components/icon.vue';
......@@ -74,7 +74,7 @@ export default {
return `
<li>
<a href='#' class='dropdown-menu-link is-active'>
${esc(stage.title)}
${escape(stage.title)}
</a>
</li>
`;
......
<script>
import $ from 'jquery';
import { escape as esc } from 'lodash';
import { escape } from 'lodash';
import { GlLoadingIcon, GlDeprecatedButton, GlAvatar } from '@gitlab/ui';
import Icon from '~/vue_shared/components/icon.vue';
import { s__, __ } from '~/locale';
......@@ -99,7 +99,7 @@ export default {
const lastPart = parts.length - 1;
return parts
.map((part, idx) =>
idx === lastPart ? `<strong>${esc(part.trim())}</strong>` : esc(part.trim()),
idx === lastPart ? `<strong>${escape(part.trim())}</strong>` : escape(part.trim()),
)
.join(' / ');
},
......
<script>
import $ from 'jquery';
import { escape as esc } from 'lodash';
import { escape } from 'lodash';
import { GlLoadingIcon, GlDeprecatedButton, GlAvatar } from '@gitlab/ui';
import Icon from '~/vue_shared/components/icon.vue';
import { n__, s__, __ } from '~/locale';
......@@ -120,7 +120,7 @@ export default {
<li>
<a href='#' class='dropdown-menu-link ${isActiveClass}'>
${this.avatarTemplate(project)}
<div class="align-middle">${esc(project.name)}</div>
<div class="align-middle">${escape(project.name)}</div>
</a>
</li>
`;
......
<script>
import $ from 'jquery';
import 'select2/select2';
import { escape as esc, debounce } from 'lodash';
import { escape, debounce } from 'lodash';
import Api from 'ee/api';
import { __ } from '~/locale';
import { TYPE_USER, TYPE_GROUP } from '../constants';
......@@ -12,7 +12,7 @@ function addType(type) {
}
function formatSelection(group) {
return esc(group.full_name || group.name);
return escape(group.full_name || group.name);
}
function formatResultUser(result) {
......@@ -25,8 +25,8 @@ function formatResultUser(result) {
${avatar}
</div>
<div class="user-info">
<div class="user-name">${esc(name)}</div>
<div class="user-username">@${esc(username)}</div>
<div class="user-name">${escape(name)}</div>
<div class="user-username">@${escape(username)}</div>
</div>
</div>
`;
......@@ -42,8 +42,8 @@ function formatResultGroup(result) {
${avatar}
</div>
<div class="group-info">
<div class="group-name">${esc(fullName)}</div>
<div class="group-path">${esc(fullPath)}</div>
<div class="group-name">${escape(fullName)}</div>
<div class="group-path">${escape(fullPath)}</div>
</div>
</div>
`;
......
<script>
import { mapActions, mapState } from 'vuex';
import { escape as esc } from 'lodash';
import { escape } from 'lodash';
import { sprintf, n__, s__ } from '~/locale';
import GlModalVuex from '~/vue_shared/components/gl_modal_vuex.vue';
......@@ -33,7 +33,7 @@ export default {
'ApprovalRuleRemove|You are about to remove the %{name} approver group which has %{nMembers}.',
),
{
name: `<strong>${esc(this.rule.name)}</strong>`,
name: `<strong>${escape(this.rule.name)}</strong>`,
nMembers: `<strong>${nMembers}</strong>`,
},
false,
......
<script>
import { escape as esc } from 'lodash';
import { escape } from 'lodash';
import { mapActions, mapState, mapGetters } from 'vuex';
import { GlLoadingIcon } from '@gitlab/ui';
import { s__ } from '~/locale';
......@@ -32,7 +32,7 @@ export default {
...mapState('subscription', ['isLoading', 'hasError', 'plan', 'tables', 'endpoint']),
...mapGetters('subscription', ['isFreePlan']),
subscriptionHeader() {
const planName = this.isFreePlan ? s__('SubscriptionTable|Free') : esc(this.plan.name);
const planName = this.isFreePlan ? s__('SubscriptionTable|Free') : escape(this.plan.name);
const suffix = !this.isFreePlan && this.plan.trial ? s__('SubscriptionTable|Trial') : '';
return `${this.namespaceName}: ${planName} ${suffix}`;
......
<script>
import { escape as esc, isEmpty } from 'lodash';
import { escape, isEmpty } from 'lodash';
import { GlTooltipDirective, GlLink, GlBadge } from '@gitlab/ui';
import Alerts from 'ee/vue_shared/dashboards/components/alerts.vue';
import TimeAgo from 'ee/vue_shared/dashboards/components/time_ago.vue';
......@@ -95,7 +95,7 @@ export default {
return (
this.commit.author || {
avatar_url: this.commit.author_gravatar_url,
path: `mailto:${esc(this.commit.author_email)}`,
path: `mailto:${escape(this.commit.author_email)}`,
username: this.commit.author_name,
}
);
......
<script>
import { escape as esc } from 'lodash';
import { escape } from 'lodash';
import { GlDeprecatedButton, GlTooltipDirective, GlModal, GlToggle } from '@gitlab/ui';
import { sprintf, s__ } from '~/locale';
import Icon from '~/vue_shared/components/icon.vue';
......@@ -41,7 +41,7 @@ export default {
return sprintf(
s__('FeatureFlags|Delete %{name}?'),
{
name: esc(this.deleteFeatureFlagName),
name: escape(this.deleteFeatureFlagName),
},
false,
);
......@@ -50,7 +50,7 @@ export default {
return sprintf(
s__('FeatureFlags|Feature flag %{name} will be removed. Are you sure?'),
{
name: esc(this.deleteFeatureFlagName),
name: escape(this.deleteFeatureFlagName),
},
false,
);
......
import { escape as esc } from 'lodash';
import { escape } from 'lodash';
import { __, sprintf } from '~/locale';
import httpStatus from '~/lib/utils/http_status';
......@@ -32,7 +32,7 @@ export const configCheckError = (status, helpUrl) => {
return sprintf(
ERROR_CONFIG,
{
helpStart: `<a href="${esc(helpUrl)}" target="_blank">`,
helpStart: `<a href="${escape(helpUrl)}" target="_blank">`,
helpEnd: '</a>',
},
false,
......@@ -48,7 +48,7 @@ export const runnersCheckEmpty = helpUrl =>
sprintf(
EMPTY_RUNNERS,
{
helpStart: `<a href="${esc(helpUrl)}" target="_blank">`,
helpStart: `<a href="${escape(helpUrl)}" target="_blank">`,
helpEnd: '</a>',
},
false,
......
......@@ -9,7 +9,7 @@ import {
GlEmptyState,
GlTable,
} from '@gitlab/ui';
import { escape as esc } from 'lodash';
import { escape } from 'lodash';
import Tracking from '~/tracking';
import PackageActivity from './activity.vue';
import PackageInformation from './information.vue';
......@@ -83,8 +83,8 @@ export default {
`PackageRegistry|You are about to delete version %{boldStart}%{version}%{boldEnd} of %{boldStart}%{name}%{boldEnd}. Are you sure?`,
),
{
version: esc(this.packageEntity.version),
name: esc(this.packageEntity.name),
version: escape(this.packageEntity.version),
name: escape(this.packageEntity.name),
boldStart: '<b>',
boldEnd: '</b>',
},
......
/* eslint-disable no-underscore-dangle, class-methods-use-this */
import { escape as esc, find, countBy } from 'lodash';
import { escape, find, countBy } from 'lodash';
import axios from '~/lib/utils/axios_utils';
import Flash from '~/flash';
import { n__, s__, __ } from '~/locale';
......@@ -471,7 +471,7 @@ export default class AccessDropdown {
<li>
<a href="#" class="${isActiveClass}">
<img src="${user.avatar_url}" class="avatar avatar-inline" width="30">
<strong class="dropdown-menu-user-full-name">${esc(user.name)}</strong>
<strong class="dropdown-menu-user-full-name">${escape(user.name)}</strong>
<span class="dropdown-menu-user-username">${user.username}</span>
</a>
</li>
......
<script>
import { mapState, mapActions } from 'vuex';
import { escape as esc } from 'lodash';
import { escape } from 'lodash';
import { GlModal } from '@gitlab/ui';
......@@ -30,13 +30,13 @@ export default {
if (this.removeItemType === ChildType.Epic) {
Object.assign(sprintfParams, {
targetEpicTitle: esc(this.removeItemModalProps.item.title),
parentEpicTitle: esc(this.parentItem.title),
targetEpicTitle: escape(this.removeItemModalProps.item.title),
parentEpicTitle: escape(this.parentItem.title),
});
} else {
Object.assign(sprintfParams, {
targetIssueTitle: esc(this.removeItemModalProps.item.title),
parentEpicTitle: esc(this.parentItem.title),
targetIssueTitle: escape(this.removeItemModalProps.item.title),
parentEpicTitle: escape(this.parentItem.title),
});
}
......
<script>
import { escape as esc } from 'lodash';
import { escape } from 'lodash';
import {
GlPopover,
GlLink,
......@@ -68,12 +68,12 @@ export default {
},
createdAt() {
return sprintf(__('created %{timeAgo}'), {
timeAgo: esc(getTimeago().format(this.requirement.createdAt)),
timeAgo: escape(getTimeago().format(this.requirement.createdAt)),
});
},
updatedAt() {
return sprintf(__('updated %{timeAgo}'), {
timeAgo: esc(getTimeago().format(this.requirement.updatedAt)),
timeAgo: escape(getTimeago().format(this.requirement.updatedAt)),
});
},
isArchived() {
......
<script>
import { GlLoadingIcon, GlLink, GlTooltip } from '@gitlab/ui';
import { escape as esc } from 'lodash';
import { escape } from 'lodash';
import { __ } from '~/locale';
import Icon from '~/vue_shared/components/icon.vue';
......@@ -39,7 +39,7 @@ export default {
// Fallback to None if immediate parent is unavailable.
let { title } = immediateParent;
title = esc(title);
title = escape(title);
const { humanReadableEndDate, humanReadableTimestamp } = immediateParent;
......
<script>
import { GlModal, GlDeprecatedButton } from '@gitlab/ui';
import { escape as esc } from 'lodash';
import { escape } from 'lodash';
import { __, sprintf } from '~/locale';
export default {
......@@ -22,7 +22,7 @@ export default {
"Merging immediately isn't recommended as it may negatively impact the existing merge train. Read the %{docsLinkStart}documentation%{docsLinkEnd} for more information.",
),
{
docsLinkStart: `<a href="${esc(
docsLinkStart: `<a href="${escape(
this.docsUrl,
)}" target="_blank" rel="noopener noreferrer">`,
docsLinkEnd: '</a>',
......
<script>
import { escape as esc } from 'lodash';
import { escape } from 'lodash';
import { GlLink } from '@gitlab/ui';
import { s__, sprintf } from '~/locale';
......@@ -37,7 +37,7 @@ export default {
'mrWidget|This merge request will be added to the merge train when pipeline %{linkStart}#%{pipelineId}%{linkEnd} succeeds.',
);
const sanitizedPipelineLink = esc(this.pipelineLink);
const sanitizedPipelineLink = escape(this.pipelineLink);
return sprintf(
text,
......
<script>
import { escape as esc } from 'lodash';
import { escape } from 'lodash';
import { __, n__, sprintf } from '~/locale';
import Icon from '~/vue_shared/components/icon.vue';
......@@ -40,8 +40,8 @@ export default {
return sprintf(
__('%{title} %{operator} %{threshold}'),
{
title: esc(this.lastAlert.title),
threshold: `${esc(this.lastAlert.threshold)}%`,
title: escape(this.lastAlert.title),
threshold: `${escape(this.lastAlert.threshold)}%`,
operator: this.lastAlert.operator,
},
false,
......
<script>
import { escape as esc } from 'lodash';
import { escape } from 'lodash';
import { mapActions, mapState } from 'vuex';
import { s__, sprintf } from '~/locale';
import DeprecatedModal2 from '~/vue_shared/components/deprecated_modal_2.vue';
......@@ -12,7 +12,7 @@ export default {
computed: {
...mapState(LICENSE_MANAGEMENT, ['currentLicenseInModal']),
confirmationText() {
const name = `<strong>${esc(this.currentLicenseInModal.name)}</strong>`;
const name = `<strong>${escape(this.currentLicenseInModal.name)}</strong>`;
return sprintf(
s__('LicenseCompliance|You are about to remove the license, %{name}, from this project.'),
......
<script>
import { escape as esc } from 'lodash';
import { escape } from 'lodash';
import EventItem from 'ee/vue_shared/security_reports/components/event_item.vue';
import { GlDeprecatedButton } from '@gitlab/ui';
import { __, sprintf } from '~/locale';
......@@ -54,7 +54,7 @@ export default {
const projectLink =
project && project.url && project.value
? `<a href="${esc(project.url)}">${esc(project.value)}</a>`
? `<a href="${escape(project.url)}">${escape(project.value)}</a>`
: null;
if (pipelineLink && projectLink) {
......
<script>
import { escape as esc } from 'lodash';
import { escape } from 'lodash';
import EventItem from 'ee/vue_shared/security_reports/components/event_item.vue';
import { __, sprintf } from '~/locale';
......@@ -24,7 +24,7 @@ export default {
const issueLink = `<a href="${feedback.issue_url}">#${feedback.issue_iid}</a>`;
if (project && project.value && project.url) {
const projectLink = `<a href="${esc(project.url)}">${esc(project.value)}</a>`;
const projectLink = `<a href="${escape(project.url)}">${escape(project.value)}</a>`;
return sprintf(
__('Created issue %{issueLink} at %{projectLink}'),
......
<script>
import { escape as esc } from 'lodash';
import { escape } from 'lodash';
import EventItem from 'ee/vue_shared/security_reports/components/event_item.vue';
import { __, sprintf } from '~/locale';
......@@ -24,7 +24,7 @@ export default {
const mergeRequestLink = `<a href="${feedback.merge_request_path}">!${feedback.merge_request_iid}</a>`;
if (project && project.value && project.url) {
const projectLink = `<a href="${esc(project.url)}">${esc(project.value)}</a>`;
const projectLink = `<a href="${escape(project.url)}">${escape(project.value)}</a>`;
return sprintf(
__('Created merge request %{mergeRequestLink} at %{projectLink}'),
......
import { escape as esc } from 'lodash';
import { escape } from 'lodash';
import { TEST_HOST } from 'spec/test_constants';
import * as messages from 'ee/ide/stores/modules/terminal/messages';
import { sprintf } from '~/locale';
......@@ -15,7 +15,7 @@ describe('EE IDE store terminal messages', () => {
sprintf(
messages.ERROR_CONFIG,
{
helpStart: `<a href="${esc(TEST_HELP_URL)}" target="_blank">`,
helpStart: `<a href="${escape(TEST_HELP_URL)}" target="_blank">`,
helpEnd: '</a>',
},
false,
......
import Vue from 'vue';
import { escape as esc } from 'lodash';
import { escape } from 'lodash';
import ancestorsTree from 'ee/sidebar/components/ancestors_tree/ancestors_tree.vue';
import mountComponent from 'helpers/vue_mount_component_helper';
......@@ -57,7 +57,7 @@ describe('AncestorsTreeContainer', () => {
it('escapes html in the tooltip', () => {
const title = '<script>alert(1);</script>';
const escapedTitle = esc(title);
const escapedTitle = escape(title);
vm.$props.ancestors = [{ id: 1, url: '', title, state: 'open' }];
......
import { escape as esc } from 'lodash';
import { escape } from 'lodash';
import VisualTokenValue from '~/filtered_search/visual_token_value';
import AjaxCache from '~/lib/utils/ajax_cache';
import UsersCache from '~/lib/utils/users_cache';
......@@ -121,7 +121,7 @@ describe('Filtered Search Visual Tokens', () => {
expect(tokenValueElement.innerText.trim()).toBe(dummyUser.name);
tokenValueElement.querySelector('.avatar').remove();
expect(tokenValueElement.innerHTML.trim()).toBe(esc(dummyUser.name));
expect(tokenValueElement.innerHTML.trim()).toBe(escape(dummyUser.name));
})
.then(done)
.catch(done.fail);
......
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