Commit debc4bda authored by Alex Buijs's avatar Alex Buijs

Add setting for enabling in product marketing emails

Prevent in product marketing emails frmo being sent
with this application setting
parent 2fa378ff
......@@ -252,6 +252,7 @@ module ApplicationSettingsHelper
:housekeeping_incremental_repack_period,
:html_emails_enabled,
:import_sources,
:in_product_marketing_emails_enabled,
:invisible_captcha_enabled,
:max_artifacts_size,
:max_attachment_size,
......
......@@ -25,4 +25,12 @@
= render_if_exists 'admin/application_settings/email_additional_text_setting', form: f
.form-group
.form-check
= f.check_box :in_product_marketing_emails_enabled, class: 'form-check-input'
= f.label :in_product_marketing_emails_enabled, class: 'form-check-label' do
= _('Enable in-product marketing emails')
.form-text.text-muted
= _('By default, GitLab sends emails to help guide users through the onboarding process.')
= f.submit _('Save changes'), class: "gl-button btn btn-success", data: { qa_selector: 'save_changes_button' }
......@@ -9,6 +9,7 @@ module Namespaces
urgency :low
def perform
return unless Gitlab::CurrentSettings.in_product_marketing_emails_enabled
return unless Gitlab::Experimentation.active?(:in_product_marketing_emails)
Namespaces::InProductMarketingEmailsService.send_for_all_tracks_and_intervals
......
---
title: Add application setting for enabling in-product marketing emails
merge_request: 54324
author:
type: added
# frozen_string_literal: true
class AddInProductMarketingEmailsEnabledSetting < ActiveRecord::Migration[6.0]
DOWNTIME = false
def change
add_column :application_settings, :in_product_marketing_emails_enabled, :boolean, null: false, default: true
end
end
0aa6f7385cf13c2b0ee9b7d2a51b63dd208feccffecee8f08ea3d183ebb5ffb4
\ No newline at end of file
......@@ -9398,6 +9398,7 @@ CREATE TABLE application_settings (
keep_latest_artifact boolean DEFAULT true NOT NULL,
notes_create_limit integer DEFAULT 300 NOT NULL,
notes_create_limit_allowlist text[] DEFAULT '{}'::text[] NOT NULL,
in_product_marketing_emails_enabled boolean DEFAULT true NOT NULL,
kroki_formats jsonb DEFAULT '{}'::jsonb NOT NULL,
CONSTRAINT app_settings_container_reg_cleanup_tags_max_list_size_positive CHECK ((container_registry_cleanup_tags_service_max_list_size >= 0)),
CONSTRAINT app_settings_registry_exp_policies_worker_capacity_positive CHECK ((container_registry_expiration_policies_worker_capacity >= 0)),
......@@ -305,6 +305,7 @@ listed in the descriptions of the relevant settings.
| `housekeeping_incremental_repack_period` | integer | required by: `housekeeping_enabled` | Number of Git pushes after which an incremental `git repack` is run. |
| `html_emails_enabled` | boolean | no | Enable HTML emails. |
| `import_sources` | array of strings | no | Sources to allow project import from, possible values: `github`, `bitbucket`, `bitbucket_server`, `gitlab`, `fogbugz`, `git`, `gitlab_project`, `gitea`, `manifest`, and `phabricator`. |
| `in_product_marketing_emails_enabled` | boolean | no | Enable in-product marketing emails. Enabled by default. |
| `invisible_captcha_enabled` | boolean | no | <!-- vale gitlab.Spelling = NO --> Enable Invisible Captcha <!-- vale gitlab.Spelling = YES --> spam detection during sign-up. Disabled by default. |
| `issues_create_limit` | integer | no | Max number of issue creation requests per minute per user. Disabled by default.|
| `local_markdown_version` | integer | no | Increase this value when any cached Markdown should be invalidated. |
......
......@@ -91,6 +91,7 @@ module API
optional :import_sources, type: Array[String], coerce_with: Validations::Types::CommaSeparatedToArray.coerce,
values: %w[github bitbucket bitbucket_server gitlab google_code fogbugz git gitlab_project gitea manifest phabricator],
desc: 'Enabled sources for code import during project creation. OmniAuth must be configured for GitHub, Bitbucket, and GitLab.com'
optional :in_product_marketing_emails_enabled, type: Boolean, desc: 'By default, in-product marketing emails are enabled. To disable these emails, disable this option.'
optional :invisible_captcha_enabled, type: Boolean, desc: 'Enable Invisible Captcha spam detection during signup.'
optional :max_artifacts_size, type: Integer, desc: "Set the maximum file size for each job's artifacts"
optional :max_attachment_size, type: Integer, desc: 'Maximum attachment size in MB'
......
......@@ -5162,6 +5162,9 @@ msgstr ""
msgid "By default GitLab sends emails in HTML and plain text formats so mail clients can choose what format to use. Disable this option if you only want to send emails in plain text format."
msgstr ""
msgid "By default, GitLab sends emails to help guide users through the onboarding process."
msgstr ""
msgid "By default, all projects and groups will use the global notifications setting."
msgstr ""
......@@ -11198,6 +11201,9 @@ msgstr ""
msgid "Enable header and footer in emails"
msgstr ""
msgid "Enable in-product marketing emails"
msgstr ""
msgid "Enable integration"
msgstr ""
......
......@@ -3,25 +3,43 @@
require 'spec_helper'
RSpec.describe Namespaces::InProductMarketingEmailsWorker, '#perform' do
context 'when the experiment is inactive' do
context 'when the application setting is enabled' do
before do
stub_experiment(in_product_marketing_emails: false)
stub_application_setting(in_product_marketing_emails_enabled: true)
end
it 'does not execute the in product marketing emails service' do
expect(Namespaces::InProductMarketingEmailsService).not_to receive(:send_for_all_tracks_and_intervals)
context 'when the experiment is inactive' do
before do
stub_experiment(in_product_marketing_emails: false)
end
subject.perform
it 'does not execute the in product marketing emails service' do
expect(Namespaces::InProductMarketingEmailsService).not_to receive(:send_for_all_tracks_and_intervals)
subject.perform
end
end
context 'when the experiment is active' do
before do
stub_experiment(in_product_marketing_emails: true)
end
it 'calls the send_for_all_tracks_and_intervals method on the in product marketing emails service' do
expect(Namespaces::InProductMarketingEmailsService).to receive(:send_for_all_tracks_and_intervals)
subject.perform
end
end
end
context 'when the experiment is active' do
context 'when the application setting is disabled' do
before do
stub_experiment(in_product_marketing_emails: true)
stub_application_setting(in_product_marketing_emails_enabled: false)
end
it 'calls the send_for_all_tracks_and_intervals method on the in product marketing emails service' do
expect(Namespaces::InProductMarketingEmailsService).to receive(:send_for_all_tracks_and_intervals)
it 'does not execute the in product marketing emails service' do
expect(Namespaces::InProductMarketingEmailsService).not_to receive(:send_for_all_tracks_and_intervals)
subject.perform
end
......
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