From b2337b5fd78f0be7b3a3f9acfc898ccba9351b9c Mon Sep 17 00:00:00 2001
From: Nataliia Radina <nradina@gitlab.com>
Date: Tue, 4 Jul 2023 19:20:46 +0000
Subject: [PATCH] Change copy for public snippets in projects

Changelog: changed
---
 app/assets/javascripts/snippets/constants.js          |  3 +++
 locale/gitlab.pot                                     |  3 +++
 .../components/snippet_visibility_edit_spec.js        | 11 +++++++++++
 3 files changed, 17 insertions(+)

diff --git a/app/assets/javascripts/snippets/constants.js b/app/assets/javascripts/snippets/constants.js
index 2d2eede91377d..a4653b75bab29 100644
--- a/app/assets/javascripts/snippets/constants.js
+++ b/app/assets/javascripts/snippets/constants.js
@@ -21,6 +21,9 @@ export const SNIPPET_VISIBILITY = {
     label: __('Public'),
     icon: 'earth',
     description: __('The snippet can be accessed without any authentication.'),
+    description_project: __(
+      'The snippet can be accessed without any authentication. To embed snippets, a project must be public.',
+    ),
   },
 };
 
diff --git a/locale/gitlab.pot b/locale/gitlab.pot
index 1c7218e249e2e..eb44b232ae3ab 100644
--- a/locale/gitlab.pot
+++ b/locale/gitlab.pot
@@ -46284,6 +46284,9 @@ msgstr ""
 msgid "The snippet can be accessed without any authentication."
 msgstr ""
 
+msgid "The snippet can be accessed without any authentication. To embed snippets, a project must be public."
+msgstr ""
+
 msgid "The snippet is visible only to me."
 msgstr ""
 
diff --git a/spec/frontend/snippets/components/snippet_visibility_edit_spec.js b/spec/frontend/snippets/components/snippet_visibility_edit_spec.js
index 70eb719f7061b..e2a9967f6ad74 100644
--- a/spec/frontend/snippets/components/snippet_visibility_edit_spec.js
+++ b/spec/frontend/snippets/components/snippet_visibility_edit_spec.js
@@ -134,6 +134,17 @@ describe('Snippet Visibility Edit component', () => {
           description: SNIPPET_VISIBILITY.private.description_project,
         });
       });
+
+      it('when project snippet, renders special public description', () => {
+        createComponent({ propsData: { isProjectSnippet: true }, deep: true });
+
+        expect(findRadiosData()[2]).toEqual({
+          value: VISIBILITY_LEVEL_PUBLIC_STRING,
+          icon: SNIPPET_VISIBILITY.public.icon,
+          text: SNIPPET_VISIBILITY.public.label,
+          description: SNIPPET_VISIBILITY.public.description_project,
+        });
+      });
     });
   });
 
-- 
GitLab