Commit 5d638022 authored by Rémy Coutable's avatar Rémy Coutable

Merge branch 'ee-48578-disable-gcp-free-credit-banner-at-instance-level' into 'master'

port 48578-disable-gcp-free-credit-banner-at-instance-level to EE

Closes gitlab-ce#48578

See merge request gitlab-org/gitlab-ee!6395
parents 73fa74f0 515ef190
...@@ -252,6 +252,7 @@ module ApplicationSettingsHelper ...@@ -252,6 +252,7 @@ module ApplicationSettingsHelper
:user_oauth_applications, :user_oauth_applications,
:version_check_enabled, :version_check_enabled,
:allow_local_requests_from_hooks_and_services, :allow_local_requests_from_hooks_and_services,
:hide_third_party_offers,
:enforce_terms, :enforce_terms,
:terms, :terms,
:mirror_available :mirror_available
......
...@@ -4,6 +4,7 @@ module ClustersHelper ...@@ -4,6 +4,7 @@ module ClustersHelper
end end
def render_gcp_signup_offer def render_gcp_signup_offer
return if Gitlab::CurrentSettings.current_application_settings.hide_third_party_offers?
return unless show_gcp_signup_offer? return unless show_gcp_signup_offer?
content_tag :section, class: 'no-animate expanded' do content_tag :section, class: 'no-animate expanded' do
......
...@@ -295,6 +295,7 @@ class ApplicationSetting < ActiveRecord::Base ...@@ -295,6 +295,7 @@ class ApplicationSetting < ActiveRecord::Base
gitaly_timeout_medium: 30, gitaly_timeout_medium: 30,
gitaly_timeout_default: 55, gitaly_timeout_default: 55,
allow_local_requests_from_hooks_and_services: false, allow_local_requests_from_hooks_and_services: false,
hide_third_party_offers: false,
mirror_available: true mirror_available: true
} }
end end
......
- application_setting = local_assigns.fetch(:application_setting)
= form_for application_setting, url: admin_application_settings_path, html: { class: 'fieldset-form' } do |f|
= form_errors(application_setting)
%fieldset
.form-group
.form-check
= f.check_box :hide_third_party_offers, class: 'form-check-input'
= f.label :hide_third_party_offers, class: 'form-check-label' do
Do not display offers from third parties within GitLab
= f.submit 'Save changes', class: "btn btn-success"
...@@ -374,4 +374,15 @@ ...@@ -374,4 +374,15 @@
.settings-content .settings-content
= render partial: 'slack' = render partial: 'slack'
%section.settings.as-third-party-offers.no-animate#js-third-party-offers-settings{ class: ('expanded' if expanded) }
.settings-header
%h4
= _('Third party offers')
%button.btn.btn-default.js-settings-toggle{ type: 'button' }
= expanded ? _('Collapse') : _('Expand')
%p
= _('Control the display of third party offers.')
.settings-content
= render 'third_party_offers', application_setting: @application_setting
= render_if_exists 'admin/application_settings/pseudonymizer_settings', expanded: expanded = render_if_exists 'admin/application_settings/pseudonymizer_settings', expanded: expanded
---
title: Add option to hide third party offers in admin application settings
merge_request: 20379
author:
type: added
class AddHideThirdPartyOffersToApplicationSettings < ActiveRecord::Migration
include Gitlab::Database::MigrationHelpers
DOWNTIME = false
disable_ddl_transaction!
def up
add_column_with_default(:application_settings, :hide_third_party_offers,
:boolean,
default: false,
allow_null: false)
end
def down
remove_column(:application_settings, :hide_third_party_offers)
end
end
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
# #
# It's strongly recommended that you check this file into your version control system. # It's strongly recommended that you check this file into your version control system.
ActiveRecord::Schema.define(version: 20180702181530) do ActiveRecord::Schema.define(version: 20180704204006) do
# These are extensions that must be enabled in order to support this database # These are extensions that must be enabled in order to support this database
enable_extension "plpgsql" enable_extension "plpgsql"
...@@ -207,6 +207,7 @@ ActiveRecord::Schema.define(version: 20180702181530) do ...@@ -207,6 +207,7 @@ ActiveRecord::Schema.define(version: 20180702181530) do
t.string "email_additional_text" t.string "email_additional_text"
t.boolean "enforce_terms", default: false t.boolean "enforce_terms", default: false
t.boolean "pseudonymizer_enabled", default: false, null: false t.boolean "pseudonymizer_enabled", default: false, null: false
t.boolean "hide_third_party_offers", default: false, null: false
end end
create_table "approvals", force: :cascade do |t| create_table "approvals", force: :cascade do |t|
......
...@@ -54,6 +54,7 @@ Learn how to install, configure, update, and maintain your GitLab instance. ...@@ -54,6 +54,7 @@ Learn how to install, configure, update, and maintain your GitLab instance.
- [Elasticsearch](../integration/elasticsearch.md): Enable Elasticsearch to empower GitLab's Advanced Global Search. Useful when you deal with a huge amount of data. **[STARTER ONLY]** - [Elasticsearch](../integration/elasticsearch.md): Enable Elasticsearch to empower GitLab's Advanced Global Search. Useful when you deal with a huge amount of data. **[STARTER ONLY]**
- [External Classification Policy Authorization](../user/admin_area/settings/external_authorization.md) **[PREMIUM ONLY]** - [External Classification Policy Authorization](../user/admin_area/settings/external_authorization.md) **[PREMIUM ONLY]**
- [Enforcing Terms of Service](../user/admin_area/settings/terms.md) - [Enforcing Terms of Service](../user/admin_area/settings/terms.md)
- [Third party offers](../user/admin_area/settings/third_party_offers.md)
#### Customizing GitLab's appearance #### Customizing GitLab's appearance
......
# Third party offers
> [Introduced](https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/20379)
> in [GitLab Core](https://about.gitlab.com/pricing/) 11.1
The display of third party offers can be controlled in the Admin Area -> Settings page.
...@@ -8,8 +8,8 @@ msgid "" ...@@ -8,8 +8,8 @@ msgid ""
msgstr "" msgstr ""
"Project-Id-Version: gitlab 1.0.0\n" "Project-Id-Version: gitlab 1.0.0\n"
"Report-Msgid-Bugs-To: \n" "Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2018-07-09 20:54+0200\n" "POT-Creation-Date: 2018-07-10 08:56+0200\n"
"PO-Revision-Date: 2018-07-09 20:54+0200\n" "PO-Revision-Date: 2018-07-10 08:56+0200\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n" "Language-Team: LANGUAGE <LL@li.org>\n"
"Language: \n" "Language: \n"
...@@ -1918,6 +1918,9 @@ msgstr "" ...@@ -1918,6 +1918,9 @@ msgstr ""
msgid "ContributorsPage|Please wait a moment, this page will automatically refresh when ready." msgid "ContributorsPage|Please wait a moment, this page will automatically refresh when ready."
msgstr "" msgstr ""
msgid "Control the display of third party offers."
msgstr ""
msgid "Control the maximum concurrency of LFS/attachment backfill for this secondary node" msgid "Control the maximum concurrency of LFS/attachment backfill for this secondary node"
msgstr "" msgstr ""
...@@ -5704,6 +5707,9 @@ msgstr "" ...@@ -5704,6 +5707,9 @@ msgstr ""
msgid "They can be managed using the %{link}." msgid "They can be managed using the %{link}."
msgstr "" msgstr ""
msgid "Third party offers"
msgstr ""
msgid "This GitLab instance does not provide any shared Runners yet. Instance administrators can register shared Runners in the admin area." msgid "This GitLab instance does not provide any shared Runners yet. Instance administrators can register shared Runners in the admin area."
msgstr "" msgstr ""
......
...@@ -297,6 +297,16 @@ describe 'Admin updates settings' do ...@@ -297,6 +297,16 @@ describe 'Admin updates settings' do
expect(Gitlab::CurrentSettings.allow_local_requests_from_hooks_and_services).to be true expect(Gitlab::CurrentSettings.allow_local_requests_from_hooks_and_services).to be true
end end
it 'Enable hiding third party offers' do
page.within('.as-third-party-offers') do
check 'Do not display offers from third parties within GitLab'
click_button 'Save changes'
end
expect(page).to have_content "Application settings saved successfully"
expect(Gitlab::CurrentSettings.hide_third_party_offers).to be true
end
it 'Change Slack Notifications Service template settings' do it 'Change Slack Notifications Service template settings' do
first(:link, 'Service Templates').click first(:link, 'Service Templates').click
click_link 'Slack notifications' click_link 'Slack notifications'
......
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