summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--app/helpers/application_settings_helper.rb1
-rw-r--r--app/helpers/clusters_helper.rb1
-rw-r--r--app/models/application_setting.rb1
-rw-r--r--app/views/admin/application_settings/_third_party_offers.html.haml13
-rw-r--r--app/views/admin/application_settings/show.html.haml11
-rw-r--r--changelogs/unreleased/48578-disable-gcp-free-credit-banner-at-instance-level.yml5
-rw-r--r--db/migrate/20180704204006_add_hide_third_party_offers_to_application_settings.rb18
-rw-r--r--db/schema.rb3
-rw-r--r--doc/administration/index.md1
-rw-r--r--doc/user/admin_area/settings/third_party_offers.md6
-rw-r--r--locale/gitlab.pot10
-rw-r--r--spec/features/admin/admin_settings_spec.rb10
12 files changed, 77 insertions, 3 deletions
diff --git a/app/helpers/application_settings_helper.rb b/app/helpers/application_settings_helper.rb
index ef1bf283d0c..358b896702b 100644
--- a/app/helpers/application_settings_helper.rb
+++ b/app/helpers/application_settings_helper.rb
@@ -251,6 +251,7 @@ module ApplicationSettingsHelper
:user_oauth_applications,
:version_check_enabled,
:allow_local_requests_from_hooks_and_services,
+ :hide_third_party_offers,
:enforce_terms,
:terms,
:mirror_available
diff --git a/app/helpers/clusters_helper.rb b/app/helpers/clusters_helper.rb
index c24d340d184..8fd0b6f14c6 100644
--- a/app/helpers/clusters_helper.rb
+++ b/app/helpers/clusters_helper.rb
@@ -4,6 +4,7 @@ module ClustersHelper
end
def render_gcp_signup_offer
+ return if Gitlab::CurrentSettings.current_application_settings.hide_third_party_offers?
return unless show_gcp_signup_offer?
content_tag :section, class: 'no-animate expanded' do
diff --git a/app/models/application_setting.rb b/app/models/application_setting.rb
index bddeb8b0352..f770b219422 100644
--- a/app/models/application_setting.rb
+++ b/app/models/application_setting.rb
@@ -294,6 +294,7 @@ class ApplicationSetting < ActiveRecord::Base
gitaly_timeout_medium: 30,
gitaly_timeout_default: 55,
allow_local_requests_from_hooks_and_services: false,
+ hide_third_party_offers: false,
mirror_available: true
}
end
diff --git a/app/views/admin/application_settings/_third_party_offers.html.haml b/app/views/admin/application_settings/_third_party_offers.html.haml
new file mode 100644
index 00000000000..c5d775d4bf5
--- /dev/null
+++ b/app/views/admin/application_settings/_third_party_offers.html.haml
@@ -0,0 +1,13 @@
+- 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"
diff --git a/app/views/admin/application_settings/show.html.haml b/app/views/admin/application_settings/show.html.haml
index bd43504dd37..5cb8001a364 100644
--- a/app/views/admin/application_settings/show.html.haml
+++ b/app/views/admin/application_settings/show.html.haml
@@ -325,5 +325,16 @@
.settings-content
= 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
diff --git a/changelogs/unreleased/48578-disable-gcp-free-credit-banner-at-instance-level.yml b/changelogs/unreleased/48578-disable-gcp-free-credit-banner-at-instance-level.yml
new file mode 100644
index 00000000000..575767df912
--- /dev/null
+++ b/changelogs/unreleased/48578-disable-gcp-free-credit-banner-at-instance-level.yml
@@ -0,0 +1,5 @@
+---
+title: Add option to hide third party offers in admin application settings
+merge_request: 20379
+author:
+type: added
diff --git a/db/migrate/20180704204006_add_hide_third_party_offers_to_application_settings.rb b/db/migrate/20180704204006_add_hide_third_party_offers_to_application_settings.rb
new file mode 100644
index 00000000000..6631c5d1b6c
--- /dev/null
+++ b/db/migrate/20180704204006_add_hide_third_party_offers_to_application_settings.rb
@@ -0,0 +1,18 @@
+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
diff --git a/db/schema.rb b/db/schema.rb
index 1898dfc6022..75a1960e2f8 100644
--- a/db/schema.rb
+++ b/db/schema.rb
@@ -11,7 +11,7 @@
#
# 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
enable_extension "plpgsql"
@@ -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 "enforce_terms", default: false
t.boolean "mirror_available", default: true, null: false
+ t.boolean "hide_third_party_offers", default: false, null: false
end
create_table "audit_events", force: :cascade do |t|
diff --git a/doc/administration/index.md b/doc/administration/index.md
index 922cc45d8c4..88190b2df5f 100644
--- a/doc/administration/index.md
+++ b/doc/administration/index.md
@@ -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.
- [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)
+- [Third party offers](../user/admin_area/settings/third_party_offers.md)
#### Customizing GitLab's appearance
diff --git a/doc/user/admin_area/settings/third_party_offers.md b/doc/user/admin_area/settings/third_party_offers.md
new file mode 100644
index 00000000000..177251b52b9
--- /dev/null
+++ b/doc/user/admin_area/settings/third_party_offers.md
@@ -0,0 +1,6 @@
+# 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.
diff --git a/locale/gitlab.pot b/locale/gitlab.pot
index b6fd7ccc1bb..f2e4eda576f 100644
--- a/locale/gitlab.pot
+++ b/locale/gitlab.pot
@@ -8,8 +8,8 @@ msgid ""
msgstr ""
"Project-Id-Version: gitlab 1.0.0\n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2018-07-09 19:16+0200\n"
-"PO-Revision-Date: 2018-07-09 19:16+0200\n"
+"POT-Creation-Date: 2018-07-10 08:56+0200\n"
+"PO-Revision-Date: 2018-07-10 08:56+0200\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
"Language: \n"
@@ -1644,6 +1644,9 @@ msgstr ""
msgid "ContributorsPage|Please wait a moment, this page will automatically refresh when ready."
msgstr ""
+msgid "Control the display of third party offers."
+msgstr ""
+
msgid "Copy URL to clipboard"
msgstr ""
@@ -4615,6 +4618,9 @@ msgstr ""
msgid "They can be managed using the %{link}."
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."
msgstr ""
diff --git a/spec/features/admin/admin_settings_spec.rb b/spec/features/admin/admin_settings_spec.rb
index 9c6758abe86..a852ca689e7 100644
--- a/spec/features/admin/admin_settings_spec.rb
+++ b/spec/features/admin/admin_settings_spec.rb
@@ -272,6 +272,16 @@ describe 'Admin updates settings' do
expect(Gitlab::CurrentSettings.allow_local_requests_from_hooks_and_services).to be true
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
first(:link, 'Service Templates').click
click_link 'Slack notifications'