Commit 4e75a27a authored by Jan Provaznik's avatar Jan Provaznik

Merge branch '340322-remove-invite-member-cookie-transfer-method' into 'master'

Remove temporary invite member cookie transfer method

See merge request gitlab-org/gitlab!73475
parents c514e2e7 f470edce
......@@ -81,32 +81,11 @@ module UserCalloutsHelper
def user_dismissed_for_group(feature_name, group, ignore_dismissal_earlier_than = nil)
return false unless current_user
set_dismissed_from_cookie(group)
current_user.dismissed_callout_for_group?(feature_name: feature_name,
group: group,
ignore_dismissal_earlier_than: ignore_dismissal_earlier_than)
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?
flash[:notice]&.include?('successfully created')
end
......
......@@ -216,20 +216,6 @@ RSpec.describe UserCalloutsHelper do
context 'when the invite_members_banner has not been dismissed' do
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
before do
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