Commit f470edce authored by Doug Stull's avatar Doug Stull

Remove temporary cookie to db invite user banner dismissal method

- no longer necessary as the time has passed to enable easy
  migration from cookies to db for this dismissal.
parent c9d4a405
...@@ -81,32 +81,11 @@ module UserCalloutsHelper ...@@ -81,32 +81,11 @@ module UserCalloutsHelper
def user_dismissed_for_group(feature_name, group, ignore_dismissal_earlier_than = nil) def user_dismissed_for_group(feature_name, group, ignore_dismissal_earlier_than = nil)
return false unless current_user return false unless current_user
set_dismissed_from_cookie(group)
current_user.dismissed_callout_for_group?(feature_name: feature_name, current_user.dismissed_callout_for_group?(feature_name: feature_name,
group: group, group: group,
ignore_dismissal_earlier_than: ignore_dismissal_earlier_than) ignore_dismissal_earlier_than: ignore_dismissal_earlier_than)
end end
def set_dismissed_from_cookie(group)
# bridge function for one milestone to try and not annoy users who might have already dismissed this alert
# remove in 14.4 or 14.5? https://gitlab.com/gitlab-org/gitlab/-/issues/340322
dismissed_key = "invite_#{group.id}_#{current_user.id}"
if cookies[dismissed_key].present?
params = {
feature_name: INVITE_MEMBERS_BANNER,
group_id: group.id
}
Users::DismissGroupCalloutService.new(
container: nil, current_user: current_user, params: params
).execute
cookies.delete dismissed_key
end
end
def just_created? def just_created?
flash[:notice]&.include?('successfully created') flash[:notice]&.include?('successfully created')
end end
......
...@@ -216,20 +216,6 @@ RSpec.describe UserCalloutsHelper do ...@@ -216,20 +216,6 @@ RSpec.describe UserCalloutsHelper do
context 'when the invite_members_banner has not been dismissed' do context 'when the invite_members_banner has not been dismissed' do
it { is_expected.to eq(true) } it { is_expected.to eq(true) }
context 'when a user has dismissed this banner via cookies already' do
before do
helper.request.cookies["invite_#{group.id}_#{user.id}"] = 'true'
end
it { is_expected.to eq(false) }
it 'creates the callout from cookie', :aggregate_failures do
expect { subject }.to change { Users::GroupCallout.count }.by(1)
expect(Users::GroupCallout.last).to have_attributes(group_id: group.id,
feature_name: described_class::INVITE_MEMBERS_BANNER)
end
end
context 'when the group was just created' do context 'when the group was just created' do
before do before do
flash[:notice] = "Group #{group.name} was successfully created" flash[:notice] = "Group #{group.name} was successfully created"
......
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