Commit 2543ad9c authored by Andrew Fontaine's avatar Andrew Fontaine

Merge branch '232537-project-deletion-ui-text-clarity' into 'master'

Improve the project deletion UI text

See merge request gitlab-org/gitlab!79363
parents 8463d7ac 2ff35c24
<script>
import { GlAlert, GlSprintf } from '@gitlab/ui';
import { __ } from '~/locale';
import SharedDeleteButton from './shared/delete_button.vue';
export default {
components: {
GlSprintf,
GlAlert,
SharedDeleteButton,
},
props: {
......@@ -39,66 +35,17 @@ export default {
required: true,
},
},
strings: {
alertTitle: __('You are about to permanently delete this project'),
alertBody: __(
'After a project is permanently deleted, it %{strongStart}cannot be recovered%{strongEnd}. Permanently deleting this project will %{strongStart}immediately delete%{strongEnd} its repositories and %{strongStart}all related resources%{strongEnd}, including issues, merge requests etc.',
),
isNotForkMessage: __(
'This project is %{strongStart}NOT%{strongEnd} a fork, and has the following:',
),
isForkMessage: __('This forked project has the following:'),
},
};
</script>
<template>
<shared-delete-button v-bind="{ confirmPhrase, formPath }">
<template #modal-body>
<gl-alert
class="gl-mb-5"
variant="danger"
:title="$options.strings.alertTitle"
:dismissible="false"
>
<p>
<gl-sprintf v-if="isFork" :message="$options.strings.isForkMessage" />
<gl-sprintf v-else :message="$options.strings.isNotForkMessage">
<template #strong="{ content }">
<strong>{{ content }}</strong>
</template>
</gl-sprintf>
</p>
<ul>
<li>
<gl-sprintf :message="n__('%d issue', '%d issues', issuesCount)">
<template #issuesCount>{{ issuesCount }}</template>
</gl-sprintf>
</li>
<li>
<gl-sprintf
:message="n__('%d merge requests', '%d merge requests', mergeRequestsCount)"
>
<template #mergeRequestsCount>{{ mergeRequestsCount }}</template>
</gl-sprintf>
</li>
<li>
<gl-sprintf :message="n__('%d fork', '%d forks', forksCount)">
<template #forksCount>{{ forksCount }}</template>
</gl-sprintf>
</li>
<li>
<gl-sprintf :message="n__('%d star', '%d stars', starsCount)">
<template #starsCount>{{ starsCount }}</template>
</gl-sprintf>
</li>
</ul>
<gl-sprintf :message="$options.strings.alertBody">
<template #strong="{ content }">
<strong>{{ content }}</strong>
</template>
</gl-sprintf>
</gl-alert>
</template>
</shared-delete-button>
<shared-delete-button
:confirm-phrase="confirmPhrase"
:form-path="formPath"
:is-fork="isFork"
:issues-count="issuesCount"
:merge-requests-count="mergeRequestsCount"
:forks-count="forksCount"
:stars-count="starsCount"
/>
</template>
<script>
import { GlModal, GlModalDirective, GlFormInput, GlButton } from '@gitlab/ui';
import { GlModal, GlModalDirective, GlFormInput, GlButton, GlAlert, GlSprintf } from '@gitlab/ui';
import { uniqueId } from 'lodash';
import csrf from '~/lib/utils/csrf';
import { __ } from '~/locale';
export default {
components: {
GlAlert,
GlModal,
GlFormInput,
GlButton,
GlSprintf,
},
directives: {
GlModal: GlModalDirective,
......@@ -22,6 +24,26 @@ export default {
type: String,
required: true,
},
isFork: {
type: Boolean,
required: true,
},
issuesCount: {
type: Number,
required: true,
},
mergeRequestsCount: {
type: Number,
required: true,
},
forksCount: {
type: Number,
required: true,
},
starsCount: {
type: Number,
required: true,
},
},
data() {
return {
......@@ -55,8 +77,17 @@ export default {
},
strings: {
deleteProject: __('Delete project'),
title: __('Delete project. Are you ABSOLUTELY SURE?'),
confirmText: __('Please type the following to confirm:'),
title: __('Are you absolutely sure?'),
confirmText: __('Enter the following to confirm:'),
isForkAlertTitle: __('You are about to delete this forked project containing:'),
isNotForkAlertTitle: __('You are about to delete this project containing:'),
isForkAlertBody: __('This process deletes the project repository and all related resources.'),
isNotForkAlertBody: __(
'This project is %{strongStart}NOT%{strongEnd} a fork. This process deletes the project repository and all related resources.',
),
isNotForkMessage: __(
'This project is %{strongStart}NOT%{strongEnd} a fork, and has the following:',
),
},
};
</script>
......@@ -83,7 +114,52 @@ export default {
>
<template #modal-title>{{ $options.strings.title }}</template>
<div>
<slot name="modal-body"></slot>
<gl-alert class="gl-mb-5" variant="danger" :dismissible="false">
<h4 v-if="isFork" data-testid="delete-alert-title" class="gl-alert-title">
{{ $options.strings.isForkAlertTitle }}
</h4>
<h4 v-else data-testid="delete-alert-title" class="gl-alert-title">
{{ $options.strings.isNotForkAlertTitle }}
</h4>
<ul>
<li>
<gl-sprintf :message="n__('%d issue', '%d issues', issuesCount)">
<template #issuesCount>{{ issuesCount }}</template>
</gl-sprintf>
</li>
<li>
<gl-sprintf
:message="n__('%d merge requests', '%d merge requests', mergeRequestsCount)"
>
<template #mergeRequestsCount>{{ mergeRequestsCount }}</template>
</gl-sprintf>
</li>
<li>
<gl-sprintf :message="n__('%d fork', '%d forks', forksCount)">
<template #forksCount>{{ forksCount }}</template>
</gl-sprintf>
</li>
<li>
<gl-sprintf :message="n__('%d star', '%d stars', starsCount)">
<template #starsCount>{{ starsCount }}</template>
</gl-sprintf>
</li>
</ul>
<gl-sprintf
v-if="isFork"
data-testid="delete-alert-body"
:message="$options.strings.isForkAlertBody"
/>
<gl-sprintf
v-else
data-testid="delete-alert-body"
:message="$options.strings.isNotForkAlertBody"
>
<template #strong="{ content }">
<strong>{{ content }}</strong>
</template>
</gl-sprintf>
</gl-alert>
<p class="gl-mb-1">{{ $options.strings.confirmText }}</p>
<p>
<code class="gl-white-space-pre-wrap">{{ confirmPhrase }}</code>
......
<script>
import { GlAlert, GlLink, GlIcon, GlSprintf } from '@gitlab/ui';
import { GlLink, GlSprintf } from '@gitlab/ui';
import { __ } from '~/locale';
import SharedDeleteButton from '~/projects/components/shared/delete_button.vue';
export default {
components: {
GlAlert,
GlSprintf,
GlIcon,
GlLink,
SharedDeleteButton,
},
......@@ -24,7 +22,7 @@ export default {
type: String,
required: true,
},
recoveryHelpPath: {
restoreHelpPath: {
type: String,
required: true,
},
......@@ -49,84 +47,36 @@ export default {
required: true,
},
},
strings: {
alertTitle: __('You are about to permanently delete this project'),
alertBody: __(
"After a project is permanently deleted, it %{strongStart}cannot be recovered%{strongEnd}. You will lose this project's repository and %{strongStart}all related resources%{strongEnd}, including issues and merge requests.",
),
helpLabel: __('Recovering projects'),
recoveryMessage: __('You can recover this project until %{date}'),
isNotForkMessage: __(
'This project is %{strongStart}NOT%{strongEnd} a fork, and has the following:',
),
isForkMessage: __('This forked project has the following:'),
restoreLabel: __('Restoring projects'),
restoreMessage: __('This project can be restored until %{date}.'),
},
};
</script>
<template>
<shared-delete-button v-bind="{ confirmPhrase, formPath }">
<template #modal-body>
<gl-alert
class="gl-mb-5"
variant="danger"
:title="$options.strings.alertTitle"
:dismissible="false"
>
<p>
<gl-sprintf v-if="isFork" :message="$options.strings.isForkMessage" />
<gl-sprintf v-else :message="$options.strings.isNotForkMessage">
<template #strong="{ content }">
<strong>{{ content }}</strong>
</template>
</gl-sprintf>
</p>
<ul>
<li>
<gl-sprintf :message="n__('%d issue', '%d issues', issuesCount)">
<template #issuesCount>{{ issuesCount }}</template>
</gl-sprintf>
</li>
<li>
<gl-sprintf
:message="n__('%d merge requests', '%d merge requests', mergeRequestsCount)"
>
<template #mergeRequestsCount>{{ mergeRequestsCount }}</template>
</gl-sprintf>
</li>
<li>
<gl-sprintf :message="n__('%d fork', '%d forks', forksCount)">
<template #forksCount>{{ forksCount }}</template>
</gl-sprintf>
</li>
<li>
<gl-sprintf :message="n__('%d star', '%d stars', starsCount)">
<template #starsCount>{{ starsCount }}</template>
</gl-sprintf>
</li>
</ul>
<gl-sprintf :message="$options.strings.alertBody">
<template #strong="{ content }">
<strong>{{ content }}</strong>
</template>
</gl-sprintf>
</gl-alert>
</template>
<shared-delete-button
:confirm-phrase="confirmPhrase"
:form-path="formPath"
:is-fork="isFork"
:issues-count="issuesCount"
:merge-requests-count="mergeRequestsCount"
:forks-count="forksCount"
:stars-count="starsCount"
>
<template #modal-footer>
<p
class="gl-display-flex gl-display-flex gl-align-items-center gl-mt-3 gl-mb-0 gl-text-gray-500"
>
<gl-sprintf :message="$options.strings.recoveryMessage">
<template #date>
{{ adjournedRemovalDate }}
</template>
<gl-sprintf :message="$options.strings.restoreMessage">
<template #date>{{ adjournedRemovalDate }}</template>
</gl-sprintf>
<gl-link
:aria-label="$options.strings.helpLabel"
class="gl-display-flex gl-ml-2 gl-text-gray-500"
:href="recoveryHelpPath"
>
<gl-icon name="question" />
:aria-label="$options.strings.restoreLabel"
class="gl-display-flex gl-ml-2"
:href="restoreHelpPath"
>{{ __('Learn More.') }}
</gl-link>
</p>
</template>
......
......@@ -11,7 +11,7 @@ export default (selector = '#js-project-adjourned-delete-button') => {
adjournedRemovalDate,
confirmPhrase,
formPath,
recoveryHelpPath,
restoreHelpPath,
isFork,
issuesCount,
mergeRequestsCount,
......@@ -28,7 +28,7 @@ export default (selector = '#js-project-adjourned-delete-button') => {
adjournedRemovalDate,
confirmPhrase,
formPath,
recoveryHelpPath,
restoreHelpPath,
isFork: parseBoolean(isFork),
issuesCount: parseInt(issuesCount, 10),
mergeRequestsCount: parseInt(mergeRequestsCount, 10),
......
......@@ -103,13 +103,13 @@ module EE
end
def permanent_delete_message(project)
message = _('This action will %{strongOpen}permanently delete%{strongClose} %{codeOpen}%{project}%{codeClose} %{strongOpen}immediately%{strongClose}, including its repositories and all related resources, including issues and merge requests.')
message = _('This action deletes %{codeOpen}%{project_path_with_namespace}%{codeClose} and everything this project contains. %{strongOpen}There is no going back%{strongClose}')
html_escape(message) % remove_message_data(project)
end
def marked_for_removal_message(project)
date = permanent_deletion_date(Time.now.utc)
message = _('This action will %{strongOpen}permanently delete%{strongClose} %{codeOpen}%{project}%{codeClose} %{strongOpen}on %{date}%{strongClose}, including its repositories and all related resources, including issues and merge requests.')
message = _("This action deletes %{codeOpen}%{project_path_with_namespace}%{codeClose} on %{date} and everything this project contains.")
html_escape(message) % remove_message_data(project).merge(date: date)
end
......@@ -260,6 +260,7 @@ module EE
def remove_message_data(project)
{
project_path_with_namespace: project.path_with_namespace,
project: project.path,
strongOpen: '<strong>'.html_safe,
strongClose: '</strong>'.html_safe,
......
- return unless can?(current_user, :remove_project, project)
- adjourned_deletion = project.adjourned_deletion?
- adjourned_date = adjourned_deletion ? permanent_deletion_date(Time.now.utc).to_s : nil
- admin_help_path = help_page_path('user/admin_area/settings/visibility_and_access_controls', anchor: 'default-deletion-delay')
- recovery_help_path = help_page_path('user/project/settings/index', anchor: 'delete-a-project')
- restore_help_path = help_page_path('user/project/settings/index', anchor: 'restore-a-project')
- merge_requests_count = Projects::AllMergeRequestsCountService.new(project).count
- issues_count = Projects::AllIssuesCountService.new(project).count
- forks_count = Projects::ForksCountService.new(project).count
- unless project.marked_for_deletion?
.sub-section
%h4.danger-title= _('Delete project')
%p
%strong= s_('Delayed Project Deletion (%{adjourned_deletion})') % { adjourned_deletion: adjourned_deletion ? 'Enabled' : 'Disabled' }
%h4.danger-title= _('Delete this project')
- if adjourned_deletion
= render 'projects/settings/marked_for_removal'
#js-project-adjourned-delete-button{ data: { recovery_help_path: recovery_help_path, adjourned_removal_date: adjourned_date, form_path: project_path(project), confirm_phrase: delete_confirm_phrase(project), is_fork: project.forked?.to_s, issues_count: number_with_delimiter(issues_count), merge_requests_count: number_with_delimiter(merge_requests_count), forks_count: number_with_delimiter(forks_count), stars_count: number_with_delimiter(project.star_count) } }
#js-project-adjourned-delete-button{ data: { restore_help_path: restore_help_path, adjourned_removal_date: adjourned_date, form_path: project_path(project), confirm_phrase: delete_confirm_phrase(project), is_fork: project.forked?.to_s, issues_count: number_with_delimiter(issues_count), merge_requests_count: number_with_delimiter(merge_requests_count), forks_count: number_with_delimiter(forks_count), stars_count: number_with_delimiter(project.star_count) } }
- else
%p
%span.gl-text-gray-500= _('Projects will be permanently deleted immediately.')
= link_to(_('Customizable by an administrator.'), admin_help_path)
%p= permanent_delete_message(project)
%p
%strong= _('Are you ABSOLUTELY SURE you wish to delete this project?')
#js-project-delete-button{ data: { form_path: project_path(project), confirm_phrase: delete_confirm_phrase(project), is_fork: project.forked?.to_s, issues_count: number_with_delimiter(issues_count), merge_requests_count: number_with_delimiter(merge_requests_count), forks_count: number_with_delimiter(forks_count), stars_count: number_with_delimiter(project.star_count) } }
- else
= render 'projects/settings/restore', project: project
......
- return unless @project.feature_available?(:adjourned_deletion_for_projects_and_groups)
%p
%span.gl-text-gray-500= _('Projects will be permanently deleted after a %{waiting_period}-day waiting period.').html_safe % { waiting_period: ::Gitlab::CurrentSettings.deletion_adjourned_period }
= link_to(_('Customizable by an administrator.'), help_page_path('user/admin_area/settings/visibility_and_access_controls', anchor: 'default-deletion-delay'))
%p= marked_for_removal_message(@project)
......@@ -3,10 +3,6 @@
- forks_count = Projects::ForksCountService.new(project).count
.sub-section
%h4.danger-title= _('Permanently delete project')
%p
%strong= _('Deleting the project will delete its repository and all related resources, including issues and merge requests.')
%h4.danger-title= _('Delete this project')
%p= permanent_delete_message(project)
%p
%strong= _('Are you ABSOLUTELY SURE you wish to delete this project?')
#js-project-delete-button{ data: { form_path: project_path(project, permanently_delete: true), confirm_phrase: delete_confirm_phrase(project), is_fork: project.forked?.to_s, issues_count: number_with_delimiter(issues_count), merge_requests_count: number_with_delimiter(merge_requests_count), forks_count: number_with_delimiter(forks_count), stars_count: number_with_delimiter(project.star_count) } }
......@@ -49,16 +49,17 @@ exports[`Project remove modal initialized matches the snapshot 1`] = `
primarybuttontext=""
secondarybuttonlink=""
secondarybuttontext=""
title="You are about to permanently delete this project"
title=""
variant="danger"
>
<p>
This project is
<strong>
NOT
</strong>
a fork, and has the following:
</p>
<h4
class="gl-alert-title"
data-testid="delete-alert-title"
>
You are about to delete this project containing:
</h4>
<ul>
<li>
......@@ -77,21 +78,17 @@ exports[`Project remove modal initialized matches the snapshot 1`] = `
4 stars
</li>
</ul>
After a project is permanently deleted, it
<strong>
cannot be recovered
</strong>
. You will lose this project's repository and
This project is
<strong>
all related resources
NOT
</strong>
, including issues and merge requests.
a fork. This process deletes the project repository and all related resources.
</gl-alert-stub>
<p
class="gl-mb-1"
>
Please type the following to confirm:
Enter the following to confirm:
</p>
<p>
......@@ -111,18 +108,14 @@ exports[`Project remove modal initialized matches the snapshot 1`] = `
<p
class="gl-display-flex gl-display-flex gl-align-items-center gl-mt-3 gl-mb-0 gl-text-gray-500"
>
You can recover this project until
2020-12-12
This project can be restored until 2020-12-12.
<gl-link-stub
aria-label="Recovering projects"
class="gl-display-flex gl-ml-2 gl-text-gray-500"
aria-label="Restoring projects"
class="gl-display-flex gl-ml-2"
href="recovery/help/path"
>
<gl-icon-stub
name="question"
size="16"
/>
Learn More.
</gl-link-stub>
</p>
</div>
......
......@@ -14,7 +14,7 @@ describe('Project remove modal', () => {
adjournedRemovalDate: '2020-12-12',
confirmPhrase: 'foo',
formPath: 'some/path',
recoveryHelpPath: 'recovery/help/path',
restoreHelpPath: 'recovery/help/path',
isFork: false,
issuesCount: 1,
mergeRequestsCount: 2,
......@@ -52,7 +52,12 @@ describe('Project remove modal', () => {
it('passes confirmPhrase and formPath props to the shared delete button', () => {
expect(findSharedDeleteButton().props()).toEqual({
confirmPhrase: defaultProps.confirmPhrase,
forksCount: defaultProps.forksCount,
formPath: defaultProps.formPath,
isFork: defaultProps.isFork,
issuesCount: defaultProps.issuesCount,
mergeRequestsCount: defaultProps.mergeRequestsCount,
starsCount: defaultProps.starsCount,
});
});
});
......
......@@ -327,6 +327,23 @@ RSpec.describe ProjectsHelper do
end
end
describe '#marked_for_removal_message' do
subject { helper.marked_for_removal_message(project) }
before do
allow(project).to receive(:adjourned_deletion?).and_return(enabled)
end
context 'when project has delayed deletion enabled' do
let(:enabled) { true }
specify do
deletion_date = helper.permanent_deletion_date(Time.now.utc)
expect(subject).to eq "This action deletes <code>#{project.path_with_namespace}</code> on #{deletion_date} and everything this project contains."
end
end
end
describe '#scheduled_for_deletion?' do
context 'when project is NOT scheduled for deletion' do
it { expect(helper.scheduled_for_deletion?(project)).to be false }
......
......@@ -3099,12 +3099,6 @@ msgstr ""
msgid "AdvancedSearch|Reindex required"
msgstr ""
msgid "After a project is permanently deleted, it %{strongStart}cannot be recovered%{strongEnd}. Permanently deleting this project will %{strongStart}immediately delete%{strongEnd} its repositories and %{strongStart}all related resources%{strongEnd}, including issues, merge requests etc."
msgstr ""
msgid "After a project is permanently deleted, it %{strongStart}cannot be recovered%{strongEnd}. You will lose this project's repository and %{strongStart}all related resources%{strongEnd}, including issues and merge requests."
msgstr ""
msgid "After a successful password update you will be redirected to login screen."
msgstr ""
......@@ -4657,10 +4651,10 @@ msgstr ""
msgid "Archiving the project will make it entirely read-only. It is hidden from the dashboard and doesn't show up in searches. %{strong_start}The repository cannot be committed to, and no issues, comments, or other entities can be created.%{strong_end} %{link_start}Learn more.%{link_end}"
msgstr ""
msgid "Are you ABSOLUTELY SURE you wish to delete this project?"
msgid "Are you ABSOLUTELY SURE you wish to remove this group?"
msgstr ""
msgid "Are you ABSOLUTELY SURE you wish to remove this group?"
msgid "Are you absolutely sure?"
msgstr ""
msgid "Are you sure that you want to archive this project?"
......@@ -10706,9 +10700,6 @@ msgstr ""
msgid "Customer relations"
msgstr ""
msgid "Customizable by an administrator."
msgstr ""
msgid "Customizable by owners."
msgstr ""
......@@ -11558,9 +11549,6 @@ msgstr ""
msgid "Definition"
msgstr ""
msgid "Delayed Project Deletion (%{adjourned_deletion})"
msgstr ""
msgid "DelayedJobs|Are you sure you want to run %{jobName} immediately? Otherwise this job will run automatically after its timer finishes."
msgstr ""
......@@ -11642,9 +11630,6 @@ msgstr ""
msgid "Delete project"
msgstr ""
msgid "Delete project. Are you ABSOLUTELY SURE?"
msgstr ""
msgid "Delete row"
msgstr ""
......@@ -11672,6 +11657,9 @@ msgstr ""
msgid "Delete this epic and all descendants?"
msgstr ""
msgid "Delete this project"
msgstr ""
msgid "Delete user list"
msgstr ""
......@@ -13661,6 +13649,9 @@ msgstr ""
msgid "Enter the code from the two-factor app on your mobile device. If you've lost your device, you may enter one of your recovery codes."
msgstr ""
msgid "Enter the following to confirm:"
msgstr ""
msgid "Enter the name of your application, and we'll return a unique %{type}."
msgstr ""
......@@ -26229,9 +26220,6 @@ msgstr ""
msgid "Permalink"
msgstr ""
msgid "Permanently delete project"
msgstr ""
msgid "Permanently remove group"
msgstr ""
......@@ -27123,9 +27111,6 @@ msgstr ""
msgid "Please type %{phrase_code} to proceed or close this modal to cancel."
msgstr ""
msgid "Please type the following to confirm:"
msgstr ""
msgid "Please use this form to report to the admin users who create spam issues, comments or behave inappropriately."
msgstr ""
......@@ -28752,12 +28737,6 @@ msgstr ""
msgid "Projects to index"
msgstr ""
msgid "Projects will be permanently deleted after a %{waiting_period}-day waiting period."
msgstr ""
msgid "Projects will be permanently deleted immediately."
msgstr ""
msgid "Projects with critical vulnerabilities"
msgstr ""
......@@ -29718,9 +29697,6 @@ msgstr ""
msgid "Reconfigure"
msgstr ""
msgid "Recovering projects"
msgstr ""
msgid "Recovery Codes"
msgstr ""
......@@ -30855,6 +30831,9 @@ msgstr ""
msgid "Restore project"
msgstr ""
msgid "Restoring projects"
msgstr ""
msgid "Restoring the group will prevent the group, its subgroups and projects from being removed on this date."
msgstr ""
......@@ -36801,10 +36780,10 @@ msgstr ""
msgid "This action cannot be undone, and will permanently delete the %{key} SSH key"
msgstr ""
msgid "This action will %{strongOpen}permanently delete%{strongClose} %{codeOpen}%{project}%{codeClose} %{strongOpen}immediately%{strongClose}, including its repositories and all related resources, including issues and merge requests."
msgid "This action deletes %{codeOpen}%{project_path_with_namespace}%{codeClose} and everything this project contains. %{strongOpen}There is no going back%{strongClose}"
msgstr ""
msgid "This action will %{strongOpen}permanently delete%{strongClose} %{codeOpen}%{project}%{codeClose} %{strongOpen}on %{date}%{strongClose}, including its repositories and all related resources, including issues and merge requests."
msgid "This action deletes %{codeOpen}%{project_path_with_namespace}%{codeClose} on %{date} and everything this project contains."
msgstr ""
msgid "This action will %{strongOpen}permanently remove%{strongClose} %{codeOpen}%{group}%{codeClose} %{strongOpen}immediately%{strongClose}."
......@@ -36933,9 +36912,6 @@ msgstr ""
msgid "This file was modified for readability, and can't accept suggestions. Edit it directly."
msgstr ""
msgid "This forked project has the following:"
msgstr ""
msgid "This form is disabled in preview"
msgstr ""
......@@ -37185,9 +37161,15 @@ msgstr ""
msgid "This pipeline was triggered by a schedule."
msgstr ""
msgid "This process deletes the project repository and all related resources."
msgstr ""
msgid "This project"
msgstr ""
msgid "This project can be restored until %{date}."
msgstr ""
msgid "This project cannot be %{visibilityLevel} because the visibility of %{openShowLink}%{name}%{closeShowLink} is %{visibility}. To make this project %{visibilityLevel}, you must first %{openEditLink}change the visibility%{closeEditLink} of the parent group."
msgstr ""
......@@ -37206,6 +37188,9 @@ msgstr ""
msgid "This project is %{strongStart}NOT%{strongEnd} a fork, and has the following:"
msgstr ""
msgid "This project is %{strongStart}NOT%{strongEnd} a fork. This process deletes the project repository and all related resources."
msgstr ""
msgid "This project is archived and cannot be commented on."
msgstr ""
......@@ -41171,7 +41156,10 @@ msgstr ""
msgid "You are about to add %{usersTag} people to the discussion. They will all receive a notification."
msgstr ""
msgid "You are about to permanently delete this project"
msgid "You are about to delete this forked project containing:"
msgstr ""
msgid "You are about to delete this project containing:"
msgstr ""
msgid "You are about to transfer the control of your account to %{group_name} group. This action is NOT reversible, you won't be able to access any of your groups and projects outside of %{group_name} once this transfer is complete."
......@@ -41402,9 +41390,6 @@ msgstr ""
msgid "You can only upload one design when dropping onto an existing design."
msgstr ""
msgid "You can recover this project until %{date}"
msgstr ""
msgid "You can resolve the merge conflict using either the Interactive mode, by choosing %{use_ours} or %{use_theirs} buttons, or by editing the files directly. Commit these changes into %{branch_name}"
msgstr ""
......
......@@ -49,16 +49,17 @@ exports[`Project remove modal initialized matches the snapshot 1`] = `
primarybuttontext=""
secondarybuttonlink=""
secondarybuttontext=""
title="You are about to permanently delete this project"
title=""
variant="danger"
>
<p>
This project is
<strong>
NOT
</strong>
a fork, and has the following:
</p>
<h4
class="gl-alert-title"
data-testid="delete-alert-title"
>
You are about to delete this project containing:
</h4>
<ul>
<li>
......@@ -77,25 +78,17 @@ exports[`Project remove modal initialized matches the snapshot 1`] = `
4 stars
</li>
</ul>
After a project is permanently deleted, it
<strong>
cannot be recovered
</strong>
. Permanently deleting this project will
<strong>
immediately delete
</strong>
its repositories and
This project is
<strong>
all related resources
NOT
</strong>
, including issues, merge requests etc.
a fork. This process deletes the project repository and all related resources.
</gl-alert-stub>
<p
class="gl-mb-1"
>
Please type the following to confirm:
Enter the following to confirm:
</p>
<p>
......
......@@ -50,7 +50,12 @@ describe('Project remove modal', () => {
it('passes confirmPhrase and formPath props to the shared delete button', () => {
expect(findSharedDeleteButton().props()).toEqual({
confirmPhrase: defaultProps.confirmPhrase,
forksCount: defaultProps.forksCount,
formPath: defaultProps.formPath,
isFork: defaultProps.isFork,
issuesCount: defaultProps.issuesCount,
mergeRequestsCount: defaultProps.mergeRequestsCount,
starsCount: defaultProps.starsCount,
});
});
});
......
......@@ -34,13 +34,63 @@ exports[`Project remove modal intialized matches the snapshot 1`] = `
ok-variant="danger"
title-class="gl-text-red-500"
>
Delete project. Are you ABSOLUTELY SURE?
Are you absolutely sure?
<div>
<gl-alert-stub
class="gl-mb-5"
dismisslabel="Dismiss"
primarybuttonlink=""
primarybuttontext=""
secondarybuttonlink=""
secondarybuttontext=""
title=""
variant="danger"
>
<h4
class="gl-alert-title"
data-testid="delete-alert-title"
>
You are about to delete this project containing:
</h4>
<ul>
<li>
<gl-sprintf-stub
message="1 issue"
/>
</li>
<li>
<gl-sprintf-stub
message="2 merge requests"
/>
</li>
<li>
<gl-sprintf-stub
message="3 forks"
/>
</li>
<li>
<gl-sprintf-stub
message="4 stars"
/>
</li>
</ul>
<gl-sprintf-stub
data-testid="delete-alert-body"
message="This project is %{strongStart}NOT%{strongEnd} a fork. This process deletes the project repository and all related resources."
/>
</gl-alert-stub>
<p
class="gl-mb-1"
>
Please type the following to confirm:
Enter the following to confirm:
</p>
<p>
......
......@@ -12,15 +12,25 @@ describe('Project remove modal', () => {
const findConfirmButton = () => wrapper.find('.js-modal-action-primary');
const findAuthenticityTokenInput = () => findFormElement().find('input[name=authenticity_token]');
const findModal = () => wrapper.find(GlModal);
const findTitle = () => wrapper.find('[data-testid="delete-alert-title"]');
const findAlertBody = () => wrapper.find('[data-testid="delete-alert-body"]');
const defaultProps = {
confirmPhrase: 'foo',
formPath: 'some/path',
isFork: false,
issuesCount: 1,
mergeRequestsCount: 2,
forksCount: 3,
starsCount: 4,
};
const createComponent = (data = {}, stubs = {}) => {
const createComponent = (data = {}, stubs = {}, props = {}) => {
wrapper = shallowMount(SharedDeleteButton, {
propsData: defaultProps,
propsData: {
...defaultProps,
...props,
},
data: () => data,
stubs: {
GlModal: stubComponent(GlModal, {
......@@ -88,4 +98,20 @@ describe('Project remove modal', () => {
expect(findFormElement().element.submit).toHaveBeenCalled();
});
});
describe('when project is a fork', () => {
beforeEach(() => {
createComponent({}, {}, { isFork: true });
});
it('matches the fork title', () => {
expect(findTitle().text()).toEqual('You are about to delete this forked project containing:');
});
it('matches the fork body', () => {
expect(findAlertBody().attributes().message).toEqual(
'This process deletes the project repository and all related resources.',
);
});
});
});
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