debian-mirror-gitlab/debian/patches/nodejs/0060-use-js-cookie-3.patch

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

222 lines
9.9 KiB
Diff
Raw Normal View History

From 810896fdaccdba0e76e5062474420c6ce85493c3 Mon Sep 17 00:00:00 2001
From: Pirate Praveen <praveen@debian.org>
Date: Wed, 20 Apr 2022 14:32:07 +0000
Subject: [PATCH] Update node module js-cookies from ^2.2.1 to ^3.0.0
---
app/assets/javascripts/lib/utils/common_utils.js | 2 +-
app/assets/javascripts/lib/utils/cookies.js | 8 ++++++++
app/assets/javascripts/main.js | 4 ----
.../javascripts/work_items_hierarchy/components/app.vue | 2 +-
.../components/qrtly_reconciliation_alert.vue | 2 +-
.../components/qrtly_reconciliation_alert_spec.js | 4 ++--
ee/spec/frontend/ee_trial_banner/ee_trial_banner_spec.js | 2 +-
ee/spec/frontend/epic/utils/epic_utils_spec.js | 2 +-
ee/spec/frontend/namespace_storage_limit_alert_spec.js | 2 +-
ee/spec/frontend/namespace_user_cap_reached_alert_spec.js | 2 +-
.../project/project_vulnerability_report_spec.js | 2 +-
ee/spec/frontend/vulnerabilities/resolution_alert_spec.js | 2 +-
package.json | 2 +-
spec/frontend/awards_handler_spec.js | 2 +-
spec/frontend/blob/pipeline_tour_success_modal_spec.js | 2 +-
spec/frontend/broadcast_notification_spec.js | 2 +-
.../design_management/components/design_sidebar_spec.js | 2 +-
spec/frontend/diffs/store/actions_spec.js | 2 +-
spec/frontend/emoji/components/utils_spec.js | 4 ++--
spec/frontend/groups/landing_spec.js | 2 +-
spec/frontend/merge_conflicts/store/actions_spec.js | 4 ++--
.../projects/learn_gitlab/components/learn_gitlab_spec.js | 2 +-
.../shared/components/pipeline_schedule_callout_spec.js | 2 +-
.../sidebar/components/issuable_sidebar_root_spec.js | 2 +-
yarn.lock | 8 ++++----
25 files changed, 37 insertions(+), 33 deletions(-)
create mode 100644 app/assets/javascripts/lib/utils/cookies.js
--- a/app/assets/javascripts/lib/utils/common_utils.js
+++ b/app/assets/javascripts/lib/utils/common_utils.js
@@ -4,8 +4,8 @@
import { GlBreakpointInstance as breakpointInstance } from '@gitlab/ui/dist/utils';
import $ from 'jquery';
-import Cookies from 'js-cookie';
import { isFunction, defer } from 'lodash';
+import Cookies from '~/lib/utils/cookies';
import { SCOPED_LABEL_DELIMITER } from '~/vue_shared/components/sidebar/labels_select_widget/constants';
import { convertToCamelCase, convertToSnakeCase } from './text_utility';
import { isObject } from './type_utility';
--- /dev/null
+++ b/app/assets/javascripts/lib/utils/cookies.js
@@ -0,0 +1,8 @@
+import CookiesBuilder from 'js-cookie';
+
+// set default path for cookies
+const Cookies = CookiesBuilder.withAttributes({
+ path: gon.relative_url_root || '/',
+});
+
+export default Cookies;
--- a/app/assets/javascripts/main.js
+++ b/app/assets/javascripts/main.js
@@ -1,7 +1,6 @@
/* global $ */
import jQuery from 'jquery';
-import Cookies from 'js-cookie';
// bootstrap webpack, common libs, polyfills, and behaviors
import './webpack';
2022-06-22 00:40:03 +05:30
@@ -178,9 +177,6 @@
initLayoutNav();
initAlertHandler();
-// Set the default path for all cookies to GitLab's root directory
-Cookies.defaults.path = gon.relative_url_root || '/';
-
// `hashchange` is not triggered when link target is already in window.location
$body.on('click', 'a[href^="#"]', function clickHashLinkCallback() {
const href = this.getAttribute('href');
--- a/app/assets/javascripts/work_items_hierarchy/components/app.vue
+++ b/app/assets/javascripts/work_items_hierarchy/components/app.vue
@@ -1,6 +1,6 @@
<script>
import { GlBanner } from '@gitlab/ui';
-import Cookies from 'js-cookie';
+import Cookies from '~/lib/utils/cookies';
import { parseBoolean } from '~/lib/utils/common_utils';
import RESPONSE from '../static_response';
import { WORK_ITEMS_SURVEY_COOKIE_NAME, workItemTypes } from '../constants';
--- a/spec/frontend/awards_handler_spec.js
+++ b/spec/frontend/awards_handler_spec.js
@@ -1,5 +1,5 @@
import $ from 'jquery';
-import Cookies from 'js-cookie';
+import Cookies from '~/lib/utils/cookies';
import { initEmojiMock, clearEmojiMock } from 'helpers/emoji';
import { useFakeRequestAnimationFrame } from 'helpers/fake_request_animation_frame';
import loadAwardsHandler from '~/awards_handler';
--- a/spec/frontend/blob/pipeline_tour_success_modal_spec.js
+++ b/spec/frontend/blob/pipeline_tour_success_modal_spec.js
@@ -1,6 +1,6 @@
import { GlSprintf, GlModal, GlLink } from '@gitlab/ui';
import { shallowMount } from '@vue/test-utils';
-import Cookies from 'js-cookie';
+import Cookies from '~/lib/utils/cookies';
import { stubComponent } from 'helpers/stub_component';
import { mockTracking, triggerEvent, unmockTracking } from 'helpers/tracking_helper';
import pipelineTourSuccess from '~/blob/pipeline_tour_success_modal.vue';
--- a/spec/frontend/broadcast_notification_spec.js
+++ b/spec/frontend/broadcast_notification_spec.js
@@ -1,4 +1,4 @@
-import Cookies from 'js-cookie';
+import Cookies from '~/lib/utils/cookies';
import initBroadcastNotifications from '~/broadcast_notification';
describe('broadcast message on dismiss', () => {
--- a/spec/frontend/design_management/components/design_sidebar_spec.js
+++ b/spec/frontend/design_management/components/design_sidebar_spec.js
@@ -1,7 +1,7 @@
import { GlCollapse, GlPopover } from '@gitlab/ui';
import { shallowMount } from '@vue/test-utils';
-import Cookies from 'js-cookie';
import { nextTick } from 'vue';
+import Cookies from '~/lib/utils/cookies';
import DesignDiscussion from '~/design_management/components/design_notes/design_discussion.vue';
import DesignNoteSignedOut from '~/design_management/components/design_notes/design_note_signed_out.vue';
import DesignSidebar from '~/design_management/components/design_sidebar.vue';
--- a/spec/frontend/diffs/store/actions_spec.js
+++ b/spec/frontend/diffs/store/actions_spec.js
@@ -1,5 +1,5 @@
import MockAdapter from 'axios-mock-adapter';
-import Cookies from 'js-cookie';
+import Cookies from '~/lib/utils/cookies';
import { useLocalStorageSpy } from 'helpers/local_storage_helper';
import { TEST_HOST } from 'helpers/test_constants';
import testAction from 'helpers/vuex_action_helper';
--- a/spec/frontend/emoji/components/utils_spec.js
+++ b/spec/frontend/emoji/components/utils_spec.js
@@ -1,7 +1,7 @@
-import Cookies from 'js-cookie';
+import Cookies from '~/lib/utils/cookies';
import { getFrequentlyUsedEmojis, addToFrequentlyUsed } from '~/emoji/components/utils';
-jest.mock('js-cookie');
+jest.mock('~/lib/utils/cookies');
describe('getFrequentlyUsedEmojis', () => {
it('it returns null when no saved emojis set', () => {
--- a/spec/frontend/groups/landing_spec.js
+++ b/spec/frontend/groups/landing_spec.js
@@ -1,4 +1,4 @@
-import Cookies from 'js-cookie';
+import Cookies from '~/lib/utils/cookies';
import Landing from '~/groups/landing';
describe('Landing', () => {
--- a/spec/frontend/merge_conflicts/store/actions_spec.js
+++ b/spec/frontend/merge_conflicts/store/actions_spec.js
@@ -1,6 +1,6 @@
import axios from 'axios';
import MockAdapter from 'axios-mock-adapter';
-import Cookies from 'js-cookie';
+import Cookies from '~/lib/utils/cookies';
import { useMockLocationHelper } from 'helpers/mock_window_location_helper';
import testAction from 'helpers/vuex_action_helper';
import createFlash from '~/flash';
@@ -11,7 +11,7 @@
jest.mock('~/flash.js');
jest.mock('~/merge_conflicts/utils');
-jest.mock('js-cookie');
+jest.mock('~/lib/utils/cookies');
describe('merge conflicts actions', () => {
let mock;
--- a/spec/frontend/pages/projects/learn_gitlab/components/learn_gitlab_spec.js
+++ b/spec/frontend/pages/projects/learn_gitlab/components/learn_gitlab_spec.js
@@ -1,6 +1,6 @@
import { GlProgressBar, GlAlert } from '@gitlab/ui';
import { mount } from '@vue/test-utils';
-import Cookies from 'js-cookie';
+import Cookies from '~/lib/utils/cookies';
import LearnGitlab from '~/pages/projects/learn_gitlab/components/learn_gitlab.vue';
import eventHub from '~/invite_members/event_hub';
import { INVITE_MODAL_OPEN_COOKIE } from '~/pages/projects/learn_gitlab/constants';
--- a/spec/frontend/pages/projects/pipeline_schedules/shared/components/pipeline_schedule_callout_spec.js
+++ b/spec/frontend/pages/projects/pipeline_schedules/shared/components/pipeline_schedule_callout_spec.js
@@ -1,7 +1,7 @@
import { GlButton } from '@gitlab/ui';
import { shallowMount } from '@vue/test-utils';
-import Cookies from 'js-cookie';
import { nextTick } from 'vue';
+import Cookies from '~/lib/utils/cookies';
import PipelineSchedulesCallout from '~/pages/projects/pipeline_schedules/shared/components/pipeline_schedules_callout.vue';
const cookieKey = 'pipeline_schedules_callout_dismissed';
--- a/spec/frontend/vue_shared/issuable/sidebar/components/issuable_sidebar_root_spec.js
+++ b/spec/frontend/vue_shared/issuable/sidebar/components/issuable_sidebar_root_spec.js
@@ -1,6 +1,6 @@
import { GlBreakpointInstance as bp } from '@gitlab/ui/dist/utils';
-import Cookies from 'js-cookie';
import { nextTick } from 'vue';
+import Cookies from '~/lib/utils/cookies';
import { shallowMountExtended } from 'helpers/vue_test_utils_helper';
import IssuableSidebarRoot from '~/vue_shared/issuable/sidebar/components/issuable_sidebar_root.vue';
--- a/yarn.lock
+++ b/yarn.lock
2022-06-22 00:40:03 +05:30
@@ -7754,10 +7754,10 @@
mkdirp "~1.0.3"
nopt "^4.0.3"
-js-cookie@^2.2.1:
- version "2.2.1"
- resolved "https://registry.yarnpkg.com/js-cookie/-/js-cookie-2.2.1.tgz#69e106dc5d5806894562902aa5baec3744e9b2b8"
- integrity sha512-HvdH2LzI/EAZcUwA8+0nKNtWHqS+ZmijLA30RwZA0bo7ToCckjK5MkGhjED9KoRcXO6BaGI3I9UIzSA1FKFPOQ==
+js-cookie@^3.0.0:
+ version "3.0.1"
+ resolved "https://registry.yarnpkg.com/js-cookie/-/js-cookie-3.0.1.tgz#9e39b4c6c2f56563708d7d31f6f5f21873a92414"
+ integrity sha512-+0rgsUXZu4ncpPxRL+lNEptWMOWl9etvPHc/koSRp6MPwpRYAhmk0dUG00J4bxVV3r9uUzfo24wW0knS07SKSw==
"js-tokens@^3.0.0 || ^4.0.0", js-tokens@^4.0.0:
version "4.0.0"