diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-09-19 04:45:44 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-09-19 04:45:44 +0300 |
commit | 85dc423f7090da0a52c73eb66faf22ddb20efff9 (patch) | |
tree | 9160f299afd8c80c038f08e1545be119f5e3f1e1 /app/assets/javascripts/snippets/utils | |
parent | 15c2c8c66dbe422588e5411eee7e68f1fa440bb8 (diff) |
Add latest changes from gitlab-org/gitlab@13-4-stable-ee
Diffstat (limited to 'app/assets/javascripts/snippets/utils')
-rw-r--r-- | app/assets/javascripts/snippets/utils/blob.js | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/app/assets/javascripts/snippets/utils/blob.js b/app/assets/javascripts/snippets/utils/blob.js index fd5ff9a3d2e..21f52671801 100644 --- a/app/assets/javascripts/snippets/utils/blob.js +++ b/app/assets/javascripts/snippets/utils/blob.js @@ -4,6 +4,8 @@ import { SNIPPET_BLOB_ACTION_UPDATE, SNIPPET_BLOB_ACTION_MOVE, SNIPPET_BLOB_ACTION_DELETE, + SNIPPET_LEVELS_MAP, + SNIPPET_VISIBILITY, } from '../constants'; const createLocalId = () => uniqueId('blob_local_'); @@ -64,3 +66,16 @@ export const diffAll = (blobs, origBlobs) => { return [...deletedEntries, ...newEntries]; }; + +export const defaultSnippetVisibilityLevels = arr => { + if (Array.isArray(arr)) { + return arr.map(l => { + const translatedLevel = SNIPPET_LEVELS_MAP[l]; + return { + value: translatedLevel, + ...SNIPPET_VISIBILITY[translatedLevel], + }; + }); + } + return []; +}; |