summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDennis Tang <750946-dennis@users.noreply.gitlab.com>2019-08-14 12:20:36 +0000
committerKushal Pandya <kushalspandya@gmail.com>2019-08-14 12:20:36 +0000
commite5dd249c4ffb18dc6928e86ae0547b071f33dd72 (patch)
tree68627c5ad44168a18edbcf452eaf9c2297a62f14
parent16f3f33e748d61b494f8815501e2a884d114255d (diff)
downloadgitlab-ce-e5dd249c4ffb18dc6928e86ae0547b071f33dd72.tar.gz
Add notification for updated privacy policy
This adds a notification to let users know of our updated privacy policy. Users can dismiss the notification either by following the link or closing the notification via an "x" icon.
-rw-r--r--app/assets/javascripts/main.js2
-rw-r--r--app/helpers/user_callouts_helper.rb6
-rw-r--r--app/models/user_callout_enums.rb3
-rw-r--r--app/views/layouts/_page.html.haml2
-rw-r--r--app/views/layouts/_privacy_policy_update_callout.html.haml6
-rw-r--r--changelogs/unreleased/64341-data-and-privacy-agreement-for-gitlab-users.yml5
-rw-r--r--locale/gitlab.pot3
-rw-r--r--spec/helpers/user_callouts_helper_spec.rb20
8 files changed, 46 insertions, 1 deletions
diff --git a/app/assets/javascripts/main.js b/app/assets/javascripts/main.js
index 9e97f345717..74497945dee 100644
--- a/app/assets/javascripts/main.js
+++ b/app/assets/javascripts/main.js
@@ -32,6 +32,7 @@ import initSearchAutocomplete from './search_autocomplete';
import GlFieldErrors from './gl_field_errors';
import initUserPopovers from './user_popovers';
import { __ } from './locale';
+import initPrivacyPolicyUpdateCallout from './privacy_policy_update_callout';
import 'ee_else_ce/main_ee';
@@ -79,6 +80,7 @@ function deferredInitialisation() {
initLogoAnimation();
initUsagePingConsent();
initUserPopovers();
+ initPrivacyPolicyUpdateCallout();
if (document.querySelector('.search')) initSearchAutocomplete();
diff --git a/app/helpers/user_callouts_helper.rb b/app/helpers/user_callouts_helper.rb
index d5e459311f7..0ff18d0039f 100644
--- a/app/helpers/user_callouts_helper.rb
+++ b/app/helpers/user_callouts_helper.rb
@@ -4,6 +4,8 @@ module UserCalloutsHelper
GKE_CLUSTER_INTEGRATION = 'gke_cluster_integration'.freeze
GCP_SIGNUP_OFFER = 'gcp_signup_offer'.freeze
SUGGEST_POPOVER_DISMISSED = 'suggest_popover_dismissed'.freeze
+ # Privacy Policy Update: https://gitlab.com/gitlab-org/gitlab-ce/issues/64341
+ PRIVACY_POLICY_UPDATE_64341 = 'privacy_policy_update_64341'.freeze
def show_gke_cluster_integration_callout?(project)
can?(current_user, :create_cluster, project) &&
@@ -25,6 +27,10 @@ module UserCalloutsHelper
!user_dismissed?(SUGGEST_POPOVER_DISMISSED)
end
+ def show_privacy_policy_update_64341?
+ !user_dismissed?(PRIVACY_POLICY_UPDATE_64341)
+ end
+
private
def user_dismissed?(feature_name)
diff --git a/app/models/user_callout_enums.rb b/app/models/user_callout_enums.rb
index 7b68e5076c7..5ad27958f4f 100644
--- a/app/models/user_callout_enums.rb
+++ b/app/models/user_callout_enums.rb
@@ -14,7 +14,8 @@ module UserCalloutEnums
gke_cluster_integration: 1,
gcp_signup_offer: 2,
cluster_security_warning: 3,
- suggest_popover_dismissed: 9
+ suggest_popover_dismissed: 9,
+ privacy_policy_update_64341: 10 # Privacy Policy Update: https://gitlab.com/gitlab-org/gitlab-ce/issues/64341
}
end
end
diff --git a/app/views/layouts/_page.html.haml b/app/views/layouts/_page.html.haml
index 006334ade07..f32757ebc51 100644
--- a/app/views/layouts/_page.html.haml
+++ b/app/views/layouts/_page.html.haml
@@ -17,4 +17,6 @@
.d-flex
%div{ class: "#{(container_class unless @no_container)} #{@content_class}" }
.content{ id: "content-body" }
+ - if Gitlab.com? && show_privacy_policy_update_64341?
+ = render "layouts/privacy_policy_update_callout"
= yield
diff --git a/app/views/layouts/_privacy_policy_update_callout.html.haml b/app/views/layouts/_privacy_policy_update_callout.html.haml
new file mode 100644
index 00000000000..9475c48fcd5
--- /dev/null
+++ b/app/views/layouts/_privacy_policy_update_callout.html.haml
@@ -0,0 +1,6 @@
+- privacy_policy_link = link_to('https://about.gitlab.com/privacy', 'https://about.gitlab.com/privacy', class: 'deferred-link', target: '_blank', rel: 'noopener noreferrer')
+%div{ class:"#{(container_class unless fluid_layout)} #{@content_class}" }
+ .bs-callout.privacy-policy-update-64341.alert.alert-block.alert-dismissable.prepend-top-default.append-bottom-default{ role: 'alert', data: { feature_id: UserCalloutsHelper::PRIVACY_POLICY_UPDATE_64341, dismiss_endpoint: user_callouts_path, defer_links: "true" } }
+ %button.close.js-close{ type: "button" }
+ = sprite_icon("close", size: 16)
+ %p= _('Our Privacy Policy has changed, please visit %{privacy_policy_link} to review these changes.').html_safe % { privacy_policy_link: privacy_policy_link }
diff --git a/changelogs/unreleased/64341-data-and-privacy-agreement-for-gitlab-users.yml b/changelogs/unreleased/64341-data-and-privacy-agreement-for-gitlab-users.yml
new file mode 100644
index 00000000000..bfd020343ac
--- /dev/null
+++ b/changelogs/unreleased/64341-data-and-privacy-agreement-for-gitlab-users.yml
@@ -0,0 +1,5 @@
+---
+title: Add notification for updated privacy policy
+merge_request: 30808
+author:
+type: added
diff --git a/locale/gitlab.pot b/locale/gitlab.pot
index 63882d94726..3c6d4df88f0 100644
--- a/locale/gitlab.pot
+++ b/locale/gitlab.pot
@@ -7703,6 +7703,9 @@ msgstr ""
msgid "Other visibility settings have been disabled by the administrator."
msgstr ""
+msgid "Our Privacy Policy has changed, please visit %{privacy_policy_link} to review these changes."
+msgstr ""
+
msgid "Outbound requests"
msgstr ""
diff --git a/spec/helpers/user_callouts_helper_spec.rb b/spec/helpers/user_callouts_helper_spec.rb
index 8fa479a4474..c85f3622464 100644
--- a/spec/helpers/user_callouts_helper_spec.rb
+++ b/spec/helpers/user_callouts_helper_spec.rb
@@ -45,6 +45,26 @@ describe UserCalloutsHelper do
end
end
+ describe '.show_privacy_policy_update_64341?' do
+ subject { helper.show_privacy_policy_update_64341? }
+
+ context 'when user has not dismissed' do
+ before do
+ allow(helper).to receive(:user_dismissed?).and_return(false)
+ end
+
+ it { is_expected.to be true }
+ end
+
+ context 'when user dismissed' do
+ before do
+ allow(helper).to receive(:user_dismissed?).and_return(true)
+ end
+
+ it { is_expected.to be false }
+ end
+ end
+
describe '.render_flash_user_callout' do
it 'renders the flash_user_callout partial' do
expect(helper).to receive(:render)