Commit fd486c93 authored by Stan Hu's avatar Stan Hu

Merge branch '55344-add-npm-package-requests-forwarding-to-application-setting' into 'master'

Add npm_package_requests_forwarding to ApplicationSetting

See merge request gitlab-org/gitlab!25346
parents bd3f826c 281109e4
# frozen_string_literal: true
class AddNpmPackageRequestsForwardingToApplicationSettings < ActiveRecord::Migration[6.0]
include Gitlab::Database::MigrationHelpers
DOWNTIME = false
disable_ddl_transaction!
def up
add_column_with_default(:application_settings, :npm_package_requests_forwarding,
:boolean,
default: false,
allow_null: false)
end
def down
remove_column(:application_settings, :npm_package_requests_forwarding)
end
end
......@@ -351,6 +351,7 @@ ActiveRecord::Schema.define(version: 2020_02_14_034836) do
t.boolean "prevent_merge_requests_committers_approval", default: false, null: false
t.boolean "email_restrictions_enabled", default: false, null: false
t.text "email_restrictions"
t.boolean "npm_package_requests_forwarding", default: false, null: false
t.index ["custom_project_templates_group_id"], name: "index_application_settings_on_custom_project_templates_group_id"
t.index ["file_template_project_id"], name: "index_application_settings_on_file_template_project_id"
t.index ["instance_administration_project_id"], name: "index_applicationsettings_on_instance_administration_project_id"
......
......@@ -54,6 +54,10 @@ module EE
attrs += EE::ApplicationSettingsHelper.merge_request_appovers_rules_attributes
end
if License.feature_available?(:packages)
attrs << :npm_package_requests_forwarding
end
attrs
end
......
......@@ -94,6 +94,7 @@ module EE
default_project_deletion_protection
deletion_adjourned_period
updating_name_disabled_for_users
npm_package_requests_forwarding
]
end
......
---
title: Add npm_package_requests_forwarding to application settings
merge_request: 25346
author:
type: added
......@@ -220,6 +220,7 @@ module EE
expose :default_project_deletion_protection, if: ->(_instance, _opts) { ::License.feature_available?(:default_project_deletion_protection) }
expose :deletion_adjourned_period, if: ->(_instance, _opts) { ::License.feature_available?(:adjourned_deletion_for_projects_and_groups) }
expose :updating_name_disabled_for_users, if: ->(_instance, _opts) { ::License.feature_available?(:disable_name_update_for_users) }
expose :npm_package_requests_forwarding, if: ->(_instance, _opts) { ::License.feature_available?(:packages) }
end
end
......
......@@ -41,6 +41,7 @@ module EE
optional :disable_overriding_approvers_per_merge_request, type: Grape::API::Boolean, desc: 'Disable Users ability to overwrite approvers in merge requests.'
optional :prevent_merge_requests_author_approval, type: Grape::API::Boolean, desc: 'Disable Merge request author ability to approve request.'
optional :prevent_merge_requests_committers_approval, type: Grape::API::Boolean, desc: 'Disable Merge request committer ability to approve request.'
optional :npm_package_requests_forwarding, type: Grape::API::Boolean, desc: 'NPM package requests are forwarded to npmjs.org if not found on GitLab.'
end
end
......
......@@ -39,6 +39,10 @@ module EE
attrs = attrs.except(*EE::ApplicationSettingsHelper.merge_request_appovers_rules_attributes)
end
unless License.feature_available?(:packages)
attrs = attrs.except(:npm_package_requests_forwarding)
end
attrs
end
end
......
......@@ -111,6 +111,13 @@ describe Admin::ApplicationSettingsController do
it_behaves_like 'settings for licensed features'
end
context 'updating npm packages request forwarding setting' do
let(:settings) { { npm_package_requests_forwarding: true } }
let(:feature) { :packages }
it_behaves_like 'settings for licensed features'
end
context 'project deletion adjourned period' do
let(:settings) { { deletion_adjourned_period: 6 } }
let(:feature) { :adjourned_deletion_for_projects_and_groups }
......
......@@ -176,4 +176,11 @@ describe API::Settings, 'EE Settings' do
it_behaves_like 'settings for licensed features'
end
context 'updating npm packages request forwarding' do
let(:settings) { { npm_package_requests_forwarding: true } }
let(:feature) { :packages }
it_behaves_like 'settings for licensed features'
end
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