Commit fe268175 authored by Dennis Tang's avatar Dennis Tang Committed by Rémy Coutable

Resolve "Disable GCP free credit banner at instance level"

parent 3d4873fa
...@@ -251,6 +251,7 @@ module ApplicationSettingsHelper ...@@ -251,6 +251,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
......
...@@ -294,6 +294,7 @@ class ApplicationSetting < ActiveRecord::Base ...@@ -294,6 +294,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"
...@@ -325,5 +325,16 @@ ...@@ -325,5 +325,16 @@
.settings-content .settings-content
= render partial: 'repository_mirrors_form' = render partial: 'repository_mirrors_form'
%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: 20180702120647) 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"
...@@ -167,6 +167,7 @@ ActiveRecord::Schema.define(version: 20180702120647) do ...@@ -167,6 +167,7 @@ ActiveRecord::Schema.define(version: 20180702120647) do
t.boolean "allow_local_requests_from_hooks_and_services", default: false, null: false t.boolean "allow_local_requests_from_hooks_and_services", default: false, null: false
t.boolean "enforce_terms", default: false t.boolean "enforce_terms", default: false
t.boolean "mirror_available", default: true, null: false t.boolean "mirror_available", default: true, null: false
t.boolean "hide_third_party_offers", default: false, null: false
end end
create_table "audit_events", force: :cascade do |t| create_table "audit_events", force: :cascade do |t|
......
...@@ -45,6 +45,7 @@ Learn how to install, configure, update, and maintain your GitLab instance. ...@@ -45,6 +45,7 @@ Learn how to install, configure, update, and maintain your GitLab instance.
- [Environment variables](environment_variables.md): Supported environment variables that can be used to override their defaults values in order to configure GitLab. - [Environment variables](environment_variables.md): Supported environment variables that can be used to override their defaults values in order to configure GitLab.
- [Plugins](plugins.md): With custom plugins, GitLab administrators can introduce custom integrations without modifying GitLab's source code. - [Plugins](plugins.md): With custom plugins, GitLab administrators can introduce custom integrations without modifying GitLab's source code.
- [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 19:16+0200\n" "POT-Creation-Date: 2018-07-10 08:56+0200\n"
"PO-Revision-Date: 2018-07-09 19:16+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"
...@@ -1644,6 +1644,9 @@ msgstr "" ...@@ -1644,6 +1644,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 "Copy URL to clipboard" msgid "Copy URL to clipboard"
msgstr "" msgstr ""
...@@ -4615,6 +4618,9 @@ msgstr "" ...@@ -4615,6 +4618,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 ""
......
...@@ -272,6 +272,16 @@ describe 'Admin updates settings' do ...@@ -272,6 +272,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