Add latest changes from gitlab-org/gitlab@master
This commit is contained in:
parent
805f27a327
commit
9d0a07a325
17 changed files with 28 additions and 24 deletions
|
@ -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';
|
||||
|
|
8
app/assets/javascripts/lib/utils/cookies.js
Normal file
8
app/assets/javascripts/lib/utils/cookies.js
Normal file
|
@ -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;
|
|
@ -1,7 +1,6 @@
|
|||
/* global $ */
|
||||
|
||||
import jQuery from 'jquery';
|
||||
import Cookies from 'js-cookie';
|
||||
|
||||
// bootstrap webpack, common libs, polyfills, and behaviors
|
||||
import './webpack';
|
||||
|
@ -178,9 +177,6 @@ initUserTracking();
|
|||
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');
|
||||
|
|
|
@ -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';
|
||||
|
|
|
@ -136,7 +136,7 @@
|
|||
"jed": "^1.1.1",
|
||||
"jquery": "^3.6.0",
|
||||
"jquery.caret": "^0.3.1",
|
||||
"js-cookie": "^2.2.1",
|
||||
"js-cookie": "^3.0.0",
|
||||
"js-yaml": "^3.13.1",
|
||||
"jszip": "^3.1.3",
|
||||
"jszip-utils": "^0.0.2",
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import $ from 'jquery';
|
||||
import Cookies from 'js-cookie';
|
||||
import Cookies from '~/lib/utils/cookies';
|
||||
import { loadHTMLFixture, resetHTMLFixture } from 'helpers/fixtures';
|
||||
import { initEmojiMock, clearEmojiMock } from 'helpers/emoji';
|
||||
import { useFakeRequestAnimationFrame } from 'helpers/fake_request_animation_frame';
|
||||
|
|
|
@ -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';
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import Cookies from 'js-cookie';
|
||||
import Cookies from '~/lib/utils/cookies';
|
||||
import { setHTMLFixture, resetHTMLFixture } from 'helpers/fixtures';
|
||||
import initBroadcastNotifications from '~/broadcast_notification';
|
||||
|
||||
|
|
|
@ -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';
|
||||
|
|
|
@ -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';
|
||||
|
|
|
@ -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', () => {
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import Cookies from 'js-cookie';
|
||||
import Cookies from '~/lib/utils/cookies';
|
||||
import Landing from '~/groups/landing';
|
||||
|
||||
describe('Landing', () => {
|
||||
|
|
|
@ -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 @@ import { restoreFileLinesState, markLine, decorateFiles } from '~/merge_conflict
|
|||
|
||||
jest.mock('~/flash.js');
|
||||
jest.mock('~/merge_conflicts/utils');
|
||||
jest.mock('js-cookie');
|
||||
jest.mock('~/lib/utils/cookies');
|
||||
|
||||
describe('merge conflicts actions', () => {
|
||||
let mock;
|
||||
|
|
|
@ -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';
|
||||
|
|
|
@ -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';
|
||||
|
|
|
@ -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 { setHTMLFixture, resetHTMLFixture } from 'helpers/fixtures';
|
||||
import { shallowMountExtended } from 'helpers/vue_test_utils_helper';
|
||||
|
||||
|
|
|
@ -7734,10 +7734,10 @@ js-beautify@^1.6.12:
|
|||
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"
|
||||
|
|
Loading…
Reference in a new issue