diff --git a/app/assets/javascripts/user_callout.js b/app/assets/javascripts/user_callout.js
index 9aa565074e4..c10f0e8de5e 100644
--- a/app/assets/javascripts/user_callout.js
+++ b/app/assets/javascripts/user_callout.js
@@ -1,4 +1,4 @@
-/* eslint-disable arrow-parens, class-methods-use-this, no-param-reassign */
+/* eslint-disable class-methods-use-this */
/* global Cookies */
const userCalloutElementName = '.user-callout';
@@ -11,21 +11,20 @@ class UserCallout {
constructor() {
this.isCalloutDismissed = Cookies.get(USER_CALLOUT_COOKIE);
this.init();
- this.isUserCalloutDismissed();
+ this.toggleUserCallout();
}
init() {
$(document)
- .on('click', closeButton, () => this.closeAndDismissCallout())
- .on('click', userCalloutBtn, () => this.closeAndDismissCallout());
+ .on('click', closeButton, () => this.dismissCallout())
+ .on('click', userCalloutBtn, () => this.dismissCallout());
}
- closeAndDismissCallout() {
- $(userCalloutElementName).hide();
- Cookies.set(USER_CALLOUT_COOKIE, '1');
+ dismissCallout() {
+ Cookies.set(USER_CALLOUT_COOKIE, 'true');
}
- isUserCalloutDismissed() {
+ toggleUserCallout() {
if (!this.isCalloutDismissed) {
$(userCalloutElementName).show();
}
diff --git a/app/views/shared/icons/_icon_customization.svg b/app/views/shared/icons/_icon_customization.svg
index b2579208039..eb1f8ba129b 100644
--- a/app/views/shared/icons/_icon_customization.svg
+++ b/app/views/shared/icons/_icon_customization.svg
@@ -1 +1 @@
-
\ No newline at end of file
+
diff --git a/app/views/users/show.html.haml b/app/views/users/show.html.haml
index d89001efb07..6203c668ff5 100644
--- a/app/views/users/show.html.haml
+++ b/app/views/users/show.html.haml
@@ -96,10 +96,9 @@
%li.js-snippets-tab
= link_to user_snippets_path, data: {target: 'div#snippets', action: 'snippets', toggle: 'tab'} do
Snippets
-
+
%div{ class: container_class }
= render partial: 'shared/user_callout'
- %div{ class: container_class }
.tab-content
#activity.tab-pane
.row-content-block.calender-block.white.second-block.hidden-xs
diff --git a/spec/javascripts/user_callout_spec.js b/spec/javascripts/user_callout_spec.js
index ba5a2656da5..097368db6e5 100644
--- a/spec/javascripts/user_callout_spec.js
+++ b/spec/javascripts/user_callout_spec.js
@@ -1,4 +1,3 @@
-/* esint-disable space-before-function-paren, arrow-body-style */
const UserCallout = require('~/user_callout');
const USER_CALLOUT_COOKIE = 'user_callout_dismissed';
@@ -14,7 +13,7 @@ describe('UserCallout', function () {
this.closeButton = $('.close-user-callout');
this.userCalloutContainer = $('.user-callout');
this.userCalloutBtn = $('.user-callout-btn');
- Cookie.set(USER_CALLOUT_COOKIE, 0);
+ Cookie.set(USER_CALLOUT_COOKIE, 'false');
});
it('shows when cookie is set to false', () => {
@@ -24,13 +23,11 @@ describe('UserCallout', function () {
it('hides when user clicks on the dismiss-icon', () => {
this.closeButton.click();
- expect(this.userCalloutContainer.is(':visible')).toBe(false);
- expect(Cookie.get(USER_CALLOUT_COOKIE)).toBe('1');
+ expect(Cookie.get(USER_CALLOUT_COOKIE)).toBe('true');
});
it('hides when user clicks on the "check it out" button', () => {
this.userCalloutBtn.click();
- expect(this.userCalloutContainer.is(':visible')).toBe(false);
- expect(Cookie.get(USER_CALLOUT_COOKIE)).toBe('1');
+ expect(Cookie.get(USER_CALLOUT_COOKIE)).toBe('true');
});
});