BigW Consortium Gitlab

Commit f8520f5d by Mike Greiling

remove manual Cookie.set "path" option in favor of global setting

parent 1c0213f2
......@@ -24,9 +24,7 @@
var filter = sender.attr("id").split("_")[0];
$('.event-filter .active').removeClass("active");
Cookies.set("event_filter", filter, {
path: gon.relative_url_root || '/'
});
Cookies.set("event_filter", filter);
sender.closest('li').toggleClass("active");
};
......
......@@ -322,10 +322,7 @@
var frequentlyUsedEmojis;
frequentlyUsedEmojis = this.getFrequentlyUsedEmojis();
frequentlyUsedEmojis.push(emoji);
Cookies.set('frequently_used_emojis', frequentlyUsedEmojis.join(','), {
path: gon.relative_url_root || '/',
expires: 365
});
Cookies.set('frequently_used_emojis', frequentlyUsedEmojis.join(','), { expires: 365 });
};
AwardsHandler.prototype.getFrequentlyUsedEmojis = function() {
......
......@@ -75,9 +75,7 @@
dismissLanding() {
store.isHelpDismissed = true;
Cookies.set(COOKIE_NAME, true, {
path: gon.relative_url_root || '/'
});
Cookies.set(COOKIE_NAME, true);
}
initDropdown() {
......
......@@ -180,9 +180,7 @@
this.state.diffView = viewType;
this.state.isParallel = viewType === VIEW_TYPES.PARALLEL;
Cookies.set('diff_view', viewType, {
path: gon.relative_url_root || '/'
});
Cookies.set('diff_view', viewType);
},
getHeadHeaderLine(id) {
......
......@@ -23,16 +23,12 @@
return $(this).parents('form').submit();
});
$('.hide-no-ssh-message').on('click', function(e) {
Cookies.set('hide_no_ssh_message', 'false', {
path: gon.relative_url_root || '/'
});
Cookies.set('hide_no_ssh_message', 'false');
$(this).parents('.no-ssh-key-message').remove();
return e.preventDefault();
});
$('.hide-no-password-message').on('click', function(e) {
Cookies.set('hide_no_password_message', 'false', {
path: gon.relative_url_root || '/'
});
Cookies.set('hide_no_password_message', 'false');
$(this).parents('.no-password-message').remove();
return e.preventDefault();
});
......
......@@ -29,9 +29,7 @@
$('.page-with-sidebar').removeClass('right-sidebar-collapsed').addClass('right-sidebar-expanded');
}
if (!triggered) {
return Cookies.set("collapsed_gutter", $('.right-sidebar').hasClass('right-sidebar-collapsed'), {
path: gon.relative_url_root || '/'
});
return Cookies.set("collapsed_gutter", $('.right-sidebar').hasClass('right-sidebar-collapsed'));
}
});
return $(document).off('click', '.js-issuable-todo').on('click', '.js-issuable-todo', this.toggleTodo);
......
......@@ -62,10 +62,7 @@
if (!this.isPinned) {
this.isExpanded = false;
}
Cookies.set(pinnedStateCookie, this.isPinned ? 'true' : 'false', {
path: gon.relative_url_root || '/',
expires: 3650
});
Cookies.set(pinnedStateCookie, this.isPinned ? 'true' : 'false', { expires: 3650 });
this.renderState();
}
......
......@@ -23,10 +23,7 @@
hideProjectLimitMessage() {
$('.hide-project-limit-message').on('click', e => {
e.preventDefault();
const path = gon.relative_url_root || '/';
Cookies.set('hide_project_limit_message', 'false', {
path: path
});
Cookies.set('hide_project_limit_message', 'false');
$(this).parents('.project-limit-message').remove();
});
}
......
......@@ -44,7 +44,6 @@
spyOn(jQuery, 'get').and.callFake(function(req, cb) {
return cb(window.emojiMenu);
});
spyOn(Cookies, 'set');
});
afterEach(function() {
// restore original url root value
......@@ -190,28 +189,6 @@
return expect($thumbsUpEmoji.data("original-title")).toBe('sam');
});
});
describe('::addEmojiToFrequentlyUsedList', function() {
it('should set a cookie with the correct default path', function() {
gon.relative_url_root = '';
awardsHandler.addEmojiToFrequentlyUsedList('sunglasses');
expect(Cookies.set)
.toHaveBeenCalledWith('frequently_used_emojis', 'sunglasses', {
path: '/',
expires: 365
})
;
});
it('should set a cookie with the correct custom root path', function() {
gon.relative_url_root = '/gitlab/subdir';
awardsHandler.addEmojiToFrequentlyUsedList('alien');
expect(Cookies.set)
.toHaveBeenCalledWith('frequently_used_emojis', 'alien', {
path: '/gitlab/subdir',
expires: 365
})
;
});
});
describe('search', function() {
return it('should filter the emoji', function() {
$('.js-add-award').eq(0).click();
......
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