Commit 2de349f7 authored by Kushal Pandya's avatar Kushal Pandya

Merge branch '241921-Replace-v-html' into 'master'

Replace v-html with v-safe-html in delete_user_modal.vue

See merge request gitlab-org/gitlab!41328
parents 551927f9 398f2f1c
<script> <script>
/* eslint-disable vue/no-v-html */ import { GlModal, GlButton, GlFormInput, GlSprintf } from '@gitlab/ui';
import { escape } from 'lodash';
import { GlModal, GlButton, GlFormInput } from '@gitlab/ui';
import { s__, sprintf } from '~/locale'; import { s__, sprintf } from '~/locale';
export default { export default {
...@@ -9,6 +7,7 @@ export default { ...@@ -9,6 +7,7 @@ export default {
GlModal, GlModal,
GlButton, GlButton,
GlFormInput, GlFormInput,
GlSprintf,
}, },
props: { props: {
title: { title: {
...@@ -53,27 +52,6 @@ export default { ...@@ -53,27 +52,6 @@ export default {
modalTitle() { modalTitle() {
return sprintf(this.title, { username: this.username }); return sprintf(this.title, { username: this.username });
}, },
text() {
return sprintf(
this.content,
{
username: `<strong>${escape(this.username)}</strong>`,
strong_start: '<strong>',
strong_end: '</strong>',
},
false,
);
},
confirmationTextLabel() {
return sprintf(
s__('AdminUsers|To confirm, type %{username}'),
{
username: `<code>${escape(this.username)}</code>`,
},
false,
);
},
secondaryButtonLabel() { secondaryButtonLabel() {
return s__('AdminUsers|Block user'); return s__('AdminUsers|Block user');
}, },
...@@ -108,8 +86,25 @@ export default { ...@@ -108,8 +86,25 @@ export default {
<template> <template>
<gl-modal ref="modal" modal-id="delete-user-modal" :title="modalTitle" kind="danger"> <gl-modal ref="modal" modal-id="delete-user-modal" :title="modalTitle" kind="danger">
<template> <template>
<p v-html="text"></p> <p>
<p v-html="confirmationTextLabel"></p> <gl-sprintf :message="content">
<template #username>
<strong>{{ username }}</strong>
</template>
<template #strong="props">
<strong>{{ props.content }}</strong>
</template>
</gl-sprintf>
</p>
<p>
<gl-sprintf :message="s__('AdminUsers|To confirm, type %{username}')">
<template #username>
<code>{{ username }}</code>
</template>
</gl-sprintf>
</p>
<form ref="form" :action="deleteUserUrl" method="post" @submit.prevent> <form ref="form" :action="deleteUserUrl" method="post" @submit.prevent>
<input ref="method" type="hidden" name="_method" value="delete" /> <input ref="method" type="hidden" name="_method" value="delete" />
<input :value="csrfToken" type="hidden" name="authenticity_token" /> <input :value="csrfToken" type="hidden" name="authenticity_token" />
......
...@@ -16,7 +16,7 @@ ...@@ -16,7 +16,7 @@
'secondary-action': s_('AdminUsers|Block user') } } 'secondary-action': s_('AdminUsers|Block user') } }
= s_('AdminUsers|You are about to permanently delete the user %{username}. Issues, merge requests, = s_('AdminUsers|You are about to permanently delete the user %{username}. Issues, merge requests,
and groups linked to them will be transferred to a system-wide "Ghost-user". To avoid data loss, and groups linked to them will be transferred to a system-wide "Ghost-user". To avoid data loss,
consider using the %{strong_start}block user%{strong_end} feature instead. Once you %{strong_start}Delete user%{strong_end}, consider using the %{strongStart}block user%{strongEnd} feature instead. Once you %{strongStart}Delete user%{strongEnd},
it cannot be undone or recovered.') it cannot be undone or recovered.')
%div{ data: { modal: "delete-with-contributions", %div{ data: { modal: "delete-with-contributions",
......
---
title: Replace v-html with v-safe-html in delete_user_modal.vue
merge_request: 41328
author: Kev @KevSlashNull
type: other
---
title: Replace v-html with v-safe-html in description.vue
merge_request: 41336
author: Kev @KevSlashNull
type: other
...@@ -2073,7 +2073,7 @@ msgstr "" ...@@ -2073,7 +2073,7 @@ msgstr ""
msgid "AdminUsers|Without projects" msgid "AdminUsers|Without projects"
msgstr "" msgstr ""
msgid "AdminUsers|You are about to permanently delete the user %{username}. Issues, merge requests, and groups linked to them will be transferred to a system-wide \"Ghost-user\". To avoid data loss, consider using the %{strong_start}block user%{strong_end} feature instead. Once you %{strong_start}Delete user%{strong_end}, it cannot be undone or recovered." msgid "AdminUsers|You are about to permanently delete the user %{username}. Issues, merge requests, and groups linked to them will be transferred to a system-wide \"Ghost-user\". To avoid data loss, consider using the %{strongStart}block user%{strongEnd} feature instead. Once you %{strongStart}Delete user%{strongEnd}, it cannot be undone or recovered."
msgstr "" msgstr ""
msgid "AdminUsers|You are about to permanently delete the user %{username}. This will delete all of the issues, merge requests, and groups linked to them. To avoid data loss, consider using the %{strong_start}block user%{strong_end} feature instead. Once you %{strong_start}Delete user%{strong_end}, it cannot be undone or recovered." msgid "AdminUsers|You are about to permanently delete the user %{username}. This will delete all of the issues, merge requests, and groups linked to them. To avoid data loss, consider using the %{strong_start}block user%{strong_end} feature instead. Once you %{strong_start}Delete user%{strong_end}, it cannot be undone or recovered."
......
...@@ -3,14 +3,15 @@ ...@@ -3,14 +3,15 @@
exports[`User Operation confirmation modal renders modal with form included 1`] = ` exports[`User Operation confirmation modal renders modal with form included 1`] = `
<div> <div>
<p> <p>
content <gl-sprintf-stub
message="content"
/>
</p> </p>
<p> <p>
To confirm, type <gl-sprintf-stub
<code> message="To confirm, type %{username}"
username />
</code>
</p> </p>
<form <form
......
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