Commit 9343dcd5 authored by David O'Regan's avatar David O'Regan Committed by Gabriel Mazetto

Remove alert endpoint dropdown user callout

parent 8224727b
......@@ -7,7 +7,6 @@ module UserCalloutsHelper
SUGGEST_POPOVER_DISMISSED = 'suggest_popover_dismissed'
TABS_POSITION_HIGHLIGHT = 'tabs_position_highlight'
WEBHOOKS_MOVED = 'webhooks_moved'
ALERTS_MOVED = 'alerts_moved'
def show_admin_integrations_moved?
!user_dismissed?(ADMIN_INTEGRATIONS_MOVED)
......@@ -44,10 +43,6 @@ module UserCalloutsHelper
!user_dismissed?(WEBHOOKS_MOVED)
end
def show_alerts_moved_alert?
!user_dismissed?(ALERTS_MOVED)
end
private
def user_dismissed?(feature_name, ignore_dismissal_earlier_than = nil)
......
......@@ -18,7 +18,6 @@ module UserCalloutEnums
tabs_position_highlight: 10,
webhooks_moved: 13,
admin_integrations_moved: 15,
alerts_moved: 20,
personal_access_token_expiry: 21 # EE-only
}
end
......
# frozen_string_literal: true
class DeleteUserCalloutAlertsMoved < ActiveRecord::Migration[6.0]
include Gitlab::Database::MigrationHelpers
DOWNTIME = false
class UserCallout < ActiveRecord::Base
include EachBatch
self.table_name = 'user_callouts'
end
BATCH_SIZE = 1_000
# Inlined from UserCalloutEnums.feature_names
FEATURE_NAME_ALERTS_MOVED = 20
def up
UserCallout.each_batch(of: BATCH_SIZE, column: :user_id) do |callout|
callout.where(feature_name: FEATURE_NAME_ALERTS_MOVED).delete_all
end
end
def down
# no-op
end
end
......@@ -23851,6 +23851,7 @@ COPY "schema_migrations" (version) FROM STDIN;
20200707095849
20200708080631
20200709101408
20200710102418
20200710102846
20200710105332
20200710130234
......
......@@ -67,26 +67,6 @@ RSpec.describe UserCalloutsHelper do
end
end
describe '.show_alerts_moved_alert?' do
subject { helper.show_alerts_moved_alert? }
context 'when user has not dismissed' do
before do
allow(helper).to receive(:user_dismissed?).with(described_class::ALERTS_MOVED) { false }
end
it { is_expected.to be true }
end
context 'when user dismissed' do
before do
allow(helper).to receive(:user_dismissed?).with(described_class::ALERTS_MOVED) { true }
end
it { is_expected.to be false }
end
end
describe '.render_flash_user_callout' do
it 'renders the flash_user_callout partial' do
expect(helper).to receive(:render)
......
# frozen_string_literal: true
require 'spec_helper'
require Rails.root.join('db', 'post_migrate', '20200710102418_delete_user_callout_alerts_moved.rb')
RSpec.describe DeleteUserCalloutAlertsMoved do
let(:users) { table(:users) }
let(:user_callouts) { table(:user_callouts) }
let(:alerts_moved_feature) { described_class::FEATURE_NAME_ALERTS_MOVED }
let(:unrelated_feature) { 1 }
let!(:user1) { users.create!(email: '1', projects_limit: 0) }
let!(:user2) { users.create!(email: '2', projects_limit: 0) }
subject(:migration) { described_class.new }
before do
user_callouts.create!(user_id: user1.id, feature_name: alerts_moved_feature)
user_callouts.create!(user_id: user1.id, feature_name: unrelated_feature)
user_callouts.create!(user_id: user2.id, feature_name: alerts_moved_feature)
end
describe '#up' do
it 'deletes `alerts_moved` user callouts' do
migration.up
expect(user_callouts.all.map(&:feature_name)).to eq([unrelated_feature])
end
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