Commit e35a8709 authored by Yorick Peterse's avatar Yorick Peterse

Disable DestroyAll for all existing EE offenses

parent 9e5843d4
......@@ -97,8 +97,8 @@ class ProjectMember < Member
def delete_member_branch_protection
if user.present? && project.present?
project.protected_branches.merge_access_by_user(user).destroy_all
project.protected_branches.push_access_by_user(user).destroy_all
project.protected_branches.merge_access_by_user(user).destroy_all # rubocop: disable DestroyAll
project.protected_branches.push_access_by_user(user).destroy_all # rubocop: disable DestroyAll
end
end
......
......@@ -51,8 +51,8 @@ class ProjectGroupLink < ActiveRecord::Base
def delete_branch_protection
if group.present? && project.present?
project.protected_branches.merge_access_by_group(group).destroy_all
project.protected_branches.push_access_by_group(group).destroy_all
project.protected_branches.merge_access_by_group(group).destroy_all # rubocop: disable DestroyAll
project.protected_branches.push_access_by_group(group).destroy_all # rubocop: disable DestroyAll
end
end
......
......@@ -38,11 +38,11 @@ module ProtectedBranches
def delete_redundant_access_levels
unless @developers_can_merge.nil?
@protected_branch.merge_access_levels.destroy_all # rubocop: disable DestroyAll
@protected_branch.merge_access_levels.destroy_all # rubocop: disable DestroyAll # rubocop: disable DestroyAll
end
unless @developers_can_push.nil?
@protected_branch.push_access_levels.destroy_all # rubocop: disable DestroyAll
@protected_branch.push_access_levels.destroy_all # rubocop: disable DestroyAll # rubocop: disable DestroyAll
end
end
......@@ -52,18 +52,18 @@ module ProtectedBranches
def delete_redundant_ee_access_levels
case @developers_can_merge
when true
@protected_branch.merge_access_levels.developer.destroy_all
@protected_branch.merge_access_levels.developer.destroy_all # rubocop: disable DestroyAll
when false
@protected_branch.merge_access_levels.developer.destroy_all
@protected_branch.merge_access_levels.maintainer.destroy_all
@protected_branch.merge_access_levels.developer.destroy_all # rubocop: disable DestroyAll
@protected_branch.merge_access_levels.maintainer.destroy_all # rubocop: disable DestroyAll
end
case @developers_can_push
when true
@protected_branch.push_access_levels.developer.destroy_all
@protected_branch.push_access_levels.developer.destroy_all # rubocop: disable DestroyAll
when false
@protected_branch.push_access_levels.developer.destroy_all
@protected_branch.push_access_levels.maintainer.destroy_all
@protected_branch.push_access_levels.developer.destroy_all # rubocop: disable DestroyAll
@protected_branch.push_access_levels.maintainer.destroy_all # rubocop: disable DestroyAll
end
end
end
......
......@@ -26,7 +26,7 @@ class Groups::LdapGroupLinksController < Groups::ApplicationController
end
def destroy
@group.ldap_group_links.where(id: params[:id]).destroy_all
@group.ldap_group_links.where(id: params[:id]).destroy_all # rubocop: disable DestroyAll
redirect_back_or_default(default: { action: 'index' }, options: { notice: 'LDAP link removed' })
end
......
......@@ -7,8 +7,8 @@ module CleanupApprovers
private
def cleanup_approvers(target, reload: false)
target.approvers.where.not(user_id: params[:approver_ids]).destroy_all
target.approver_groups.where.not(group_id: params[:approver_group_ids]).destroy_all
target.approvers.where.not(user_id: params[:approver_ids]).destroy_all # rubocop: disable DestroyAll
target.approver_groups.where.not(group_id: params[:approver_group_ids]).destroy_all # rubocop: disable DestroyAll
# If the target already has `approvers` and/or `approver_groups` loaded then we need to
# force a reload in order to not return stale information after the destroys above
......
......@@ -8,7 +8,7 @@ module MergeRequests
currently_approved = merge_request.approved?
if approval.destroy_all
if approval.destroy_all # rubocop: disable DestroyAll
merge_request.reset_approval_cache!
create_note(merge_request)
......
......@@ -48,7 +48,7 @@ describe Projects::Settings::IntegrationsController do
context 'without a license key' do
before do
License.destroy_all
License.destroy_all # rubocop: disable DestroyAll
end
it_behaves_like 'endpoint with some disabled services'
......
......@@ -11,7 +11,7 @@ describe "Admin uploads license" do
set(:license) { build(:license, data: build(:gitlab_license, restrictions: { active_user_count: 2000 }).export) }
before do
License.destroy_all
License.destroy_all # rubocop: disable DestroyAll
visit(admin_license_path(trial_key: license.data))
end
......
......@@ -156,7 +156,7 @@ describe Gitlab::Database::LoadBalancing do
context 'without a license' do
before do
License.destroy_all
License.destroy_all # rubocop: disable DestroyAll
end
it 'is disabled' do
......
......@@ -53,7 +53,7 @@ describe Burndown do
context "when all closed issues does not have closed events" do
before do
Event.where(target: milestone.issues, action: Event::CLOSED).destroy_all
Event.where(target: milestone.issues, action: Event::CLOSED).destroy_all # rubocop: disable DestroyAll
end
it "considers closed_at as milestone start date" do
......@@ -73,7 +73,7 @@ describe Burndown do
context "when one or more closed issues does not have a closed event" do
before do
Event.where(target: milestone.issues.closed.first, action: Event::CLOSED).destroy_all
Event.where(target: milestone.issues.closed.first, action: Event::CLOSED).destroy_all # rubocop: disable DestroyAll
end
it "sets attribute accurate to false" do
......
......@@ -560,7 +560,7 @@ describe License do
let(:license) { create(:license, trial: true, expired: true) }
before(:all) do
described_class.destroy_all
described_class.destroy_all # rubocop: disable DestroyAll
end
::License::EES_FEATURES.each do |feature|
......
......@@ -134,7 +134,7 @@ ICON_STATUS_HTML
context 'without a license key' do
before do
License.destroy_all
License.destroy_all # rubocop: disable DestroyAll
end
it_behaves_like 'a disabled jenkins deprecated service'
......
......@@ -164,7 +164,7 @@ describe JenkinsService do
context 'without a license key' do
before do
License.destroy_all
License.destroy_all # rubocop: disable DestroyAll
end
it_behaves_like 'project with disabled Jenkins service'
......
......@@ -774,7 +774,7 @@ describe Project do
context 'without a License' do
before do
License.destroy_all
License.destroy_all # rubocop: disable DestroyAll
end
it 'is disabled' do
......@@ -1123,7 +1123,7 @@ describe Project do
context 'without a license key' do
before do
License.destroy_all
License.destroy_all # rubocop: disable DestroyAll
end
it_behaves_like 'project with disabled services'
......
......@@ -7,7 +7,7 @@ RSpec.configure do |config|
config.include EE::LicenseHelpers
config.before(:all) do
License.destroy_all
License.destroy_all # rubocop: disable DestroyAll
TestLicense.init
end
......
......@@ -30,7 +30,7 @@ describe HistoricalDataWorker do
context 'when there is not a license key' do
it 'does not track historical data' do
License.destroy_all
License.destroy_all # rubocop: disable DestroyAll
expect(HistoricalData).not_to receive(:track!)
......
......@@ -19,7 +19,7 @@ describe LdapAllGroupsSyncWorker do
context 'without a license key' do
before do
License.destroy_all
License.destroy_all # rubocop: disable DestroyAll
end
it 'does not sync all groups' do
......
......@@ -35,7 +35,7 @@ describe LdapGroupSyncWorker do
context 'without a license key' do
before do
License.destroy_all
License.destroy_all # rubocop: disable DestroyAll
end
it 'does not sync groups' do
......
......@@ -21,7 +21,7 @@ describe LdapSyncWorker do
context 'without a license key' do
before do
License.destroy_all
License.destroy_all # rubocop: disable DestroyAll
end
it 'does not sync LDAP users' do
......
......@@ -448,7 +448,7 @@ describe MergeRequests::UpdateService, :mailer do
update_merge_request(approver_ids: [existing_approver, removed_approver].map(&:id).join(','))
end
Todo.where(action: Todo::APPROVAL_REQUIRED).destroy_all
Todo.where(action: Todo::APPROVAL_REQUIRED).destroy_all # rubocop: disable DestroyAll
ActionMailer::Base.deliveries.clear
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