Commit c12f6cdf authored by Kamil Trzciński's avatar Kamil Trzciński

Merge branch '13665-data-and-privacy-agreement-for-gitlab-users' into 'master'

Resolve "Data and Privacy Agreement for GitLab users"

Closes #13665

See merge request gitlab-org/gitlab!15435
parents cc723071 c8a56bf1
...@@ -37,6 +37,7 @@ import GlFieldErrors from './gl_field_errors'; ...@@ -37,6 +37,7 @@ import GlFieldErrors from './gl_field_errors';
import initUserPopovers from './user_popovers'; import initUserPopovers from './user_popovers';
import { initUserTracking } from './tracking'; import { initUserTracking } from './tracking';
import { __ } from './locale'; import { __ } from './locale';
import initPrivacyPolicyUpdateCallout from './privacy_policy_update_callout';
import 'ee_else_ce/main_ee'; import 'ee_else_ce/main_ee';
...@@ -96,6 +97,7 @@ function deferredInitialisation() { ...@@ -96,6 +97,7 @@ function deferredInitialisation() {
initUsagePingConsent(); initUsagePingConsent();
initUserPopovers(); initUserPopovers();
initUserTracking(); initUserTracking();
initPrivacyPolicyUpdateCallout();
if (document.querySelector('.search')) initSearchAutocomplete(); if (document.querySelector('.search')) initSearchAutocomplete();
......
import PersistentUserCallout from '~/persistent_user_callout'; import PersistentUserCallout from '~/persistent_user_callout';
function initPrivacyPolicyUpdateCallout() { function initPrivacyPolicyUpdateCallout() {
const callout = document.querySelector('.privacy-policy-update-64341'); const callout = document.querySelector('.js-privacy-policy-update');
PersistentUserCallout.factory(callout); PersistentUserCallout.factory(callout);
} }
......
...@@ -17,4 +17,6 @@ ...@@ -17,4 +17,6 @@
%div{ class: "#{(container_class unless @no_container)} #{@content_class}" } %div{ class: "#{(container_class unless @no_container)} #{@content_class}" }
.content{ id: "content-body" } .content{ id: "content-body" }
= render "layouts/flash", extra_flash_class: 'limit-container-width' = render "layouts/flash", extra_flash_class: 'limit-container-width'
- if Gitlab.com?
= render_if_exists "layouts/privacy_policy_update_callout"
= yield = yield
...@@ -9,6 +9,9 @@ module EE ...@@ -9,6 +9,9 @@ module EE
CANARY_DEPLOYMENT = 'canary_deployment' CANARY_DEPLOYMENT = 'canary_deployment'
GOLD_TRIAL = 'gold_trial' GOLD_TRIAL = 'gold_trial'
GOLD_TRIAL_BILLINGS = 'gold_trial_billings' 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) def show_canary_deployment_callout?(project)
!user_dismissed?(CANARY_DEPLOYMENT) && !user_dismissed?(CANARY_DEPLOYMENT) &&
...@@ -62,6 +65,10 @@ module EE ...@@ -62,6 +65,10 @@ module EE
render 'shared/gold_trial_callout_content', is_dismissable: !namespace.free_plan?, callout: GOLD_TRIAL_BILLINGS render 'shared/gold_trial_callout_content', is_dismissable: !namespace.free_plan?, callout: GOLD_TRIAL_BILLINGS
end end
def show_privacy_policy_update?
!user_dismissed?(PRIVACY_POLICY_UPDATE)
end
private private
def hashed_storage_enabled? def hashed_storage_enabled?
......
...@@ -14,7 +14,9 @@ module EE ...@@ -14,7 +14,9 @@ module EE
geo_enable_hashed_storage: 5, geo_enable_hashed_storage: 5,
geo_migrate_hashed_storage: 6, geo_migrate_hashed_storage: 6,
canary_deployment: 7, 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 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 ...@@ -168,6 +168,26 @@ describe EE::UserCalloutsHelper do
end end
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 describe '#render_dashboard_gold_trial' do
using RSpec::Parameterized::TableSyntax using RSpec::Parameterized::TableSyntax
......
...@@ -25,7 +25,7 @@ shared_examples 'dashboard gold trial callout' do ...@@ -25,7 +25,7 @@ shared_examples 'dashboard gold trial callout' do
expect(page).to have_selector '.promotion-callout' 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' expect(page).not_to have_selector '.promotion-callout'
end end
...@@ -72,7 +72,7 @@ shared_examples 'billings gold trial callout' do ...@@ -72,7 +72,7 @@ shared_examples 'billings gold trial callout' do
it 'renders an undismissable gold trial callout' do it 'renders an undismissable gold trial callout' do
expect(page).to have_selector '.promotion-callout' 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
end end
...@@ -95,7 +95,7 @@ shared_examples 'billings gold trial callout' do ...@@ -95,7 +95,7 @@ shared_examples 'billings gold trial callout' do
it 'renders a dismissable gold trial callout' do it 'renders a dismissable gold trial callout' do
expect(page).to have_selector '.promotion-callout' 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' expect(page).not_to have_selector '.promotion-callout'
end end
......
...@@ -10744,6 +10744,9 @@ msgstr "" ...@@ -10744,6 +10744,9 @@ msgstr ""
msgid "Other visibility settings have been disabled by the administrator." msgid "Other visibility settings have been disabled by the administrator."
msgstr "" msgstr ""
msgid "Our Privacy Policy has changed, please visit %{privacy_policy_link} to review these changes."
msgstr ""
msgid "Outbound requests" msgid "Outbound requests"
msgstr "" 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