Commit c8a56bf1 authored by Dennis Tang's avatar Dennis Tang Committed by Kamil Trzciński

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.
parent cc723071
......@@ -37,6 +37,7 @@ import GlFieldErrors from './gl_field_errors';
import initUserPopovers from './user_popovers';
import { initUserTracking } from './tracking';
import { __ } from './locale';
import initPrivacyPolicyUpdateCallout from './privacy_policy_update_callout';
import 'ee_else_ce/main_ee';
......@@ -96,6 +97,7 @@ function deferredInitialisation() {
initUsagePingConsent();
initUserPopovers();
initUserTracking();
initPrivacyPolicyUpdateCallout();
if (document.querySelector('.search')) initSearchAutocomplete();
......
import PersistentUserCallout from '~/persistent_user_callout';
function initPrivacyPolicyUpdateCallout() {
const callout = document.querySelector('.privacy-policy-update-64341');
const callout = document.querySelector('.js-privacy-policy-update');
PersistentUserCallout.factory(callout);
}
......
......@@ -17,4 +17,6 @@
%div{ class: "#{(container_class unless @no_container)} #{@content_class}" }
.content{ id: "content-body" }
= render "layouts/flash", extra_flash_class: 'limit-container-width'
- if Gitlab.com?
= render_if_exists "layouts/privacy_policy_update_callout"
= yield
......@@ -9,6 +9,9 @@ module EE
CANARY_DEPLOYMENT = 'canary_deployment'
GOLD_TRIAL = 'gold_trial'
GOLD_TRIAL_BILLINGS = 'gold_trial_billings'
# Privacy Policy Update: https://gitlab.com/gitlab-org/gitlab/issues/13665
LATEST_PRIVACY_POLICY_UPDATE = '13665'
PRIVACY_POLICY_UPDATE = "privacy_policy_update_#{LATEST_PRIVACY_POLICY_UPDATE}"
def show_canary_deployment_callout?(project)
!user_dismissed?(CANARY_DEPLOYMENT) &&
......@@ -62,6 +65,10 @@ module EE
render 'shared/gold_trial_callout_content', is_dismissable: !namespace.free_plan?, callout: GOLD_TRIAL_BILLINGS
end
def show_privacy_policy_update?
!user_dismissed?(PRIVACY_POLICY_UPDATE)
end
private
def hashed_storage_enabled?
......
......@@ -14,7 +14,9 @@ module EE
geo_enable_hashed_storage: 5,
geo_migrate_hashed_storage: 6,
canary_deployment: 7,
gold_trial_billings: 8)
gold_trial_billings: 8,
privacy_policy_update_13665: 10 # Privacy Policy Update: https://gitlab.com/gitlab-org/gitlab/issues/13665
)
end
end
end
......
- privacy_policy_link = link_to('https://about.gitlab.com/privacy', 'https://about.gitlab.com/privacy', class: 'deferred-link', target: '_blank', rel: 'noopener noreferrer')
- if show_privacy_policy_update?
%div{ class:"#{(container_class unless fluid_layout)} #{@content_class}" }
.bs-callout.js-privacy-policy-update.alert.alert-block.alert-dismissable.prepend-top-default.append-bottom-default{ role: 'alert', data: { feature_id: UserCalloutsHelper::PRIVACY_POLICY_UPDATE, 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 }
---
title: Add notification for updated privacy policy
merge_request: 15435
author:
type: added
......@@ -168,6 +168,26 @@ describe EE::UserCalloutsHelper do
end
end
describe '.show_privacy_policy_update?' do
subject { helper.show_privacy_policy_update? }
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_dashboard_gold_trial' do
using RSpec::Parameterized::TableSyntax
......
......@@ -25,7 +25,7 @@ shared_examples 'dashboard gold trial callout' do
expect(page).to have_selector '.promotion-callout'
find('.js-close').click
find('.promotion-callout .js-close').click
expect(page).not_to have_selector '.promotion-callout'
end
......@@ -72,7 +72,7 @@ shared_examples 'billings gold trial callout' do
it 'renders an undismissable gold trial callout' do
expect(page).to have_selector '.promotion-callout'
expect(page).not_to have_selector '.js-close'
expect(page).not_to have_selector '.promotion-callout .js-close'
end
end
......@@ -95,7 +95,7 @@ shared_examples 'billings gold trial callout' do
it 'renders a dismissable gold trial callout' do
expect(page).to have_selector '.promotion-callout'
find('.js-close').click
find('.promotion-callout .js-close').click
expect(page).not_to have_selector '.promotion-callout'
end
......
......@@ -10744,6 +10744,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 ""
......
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