Commit f419a2e3 authored by Heinrich Lee Yu's avatar Heinrich Lee Yu

Merge branch 'reminder-emails-invitation-declined-screen' into 'master'

Add invitation declined page

See merge request gitlab-org/gitlab!43305
parents 366826d5 ca5ac4b1
......@@ -57,4 +57,8 @@
height: $default-icon-size;
}
}
.decline-page {
width: 350px;
}
}
......@@ -30,6 +30,8 @@ class InvitesController < ApplicationController
def decline
if member.decline_invite!
return render layout: 'devise_experimental_onboarding_issues' if !current_user && member.invite_to_unknown_user? && member.created_by
path =
if current_user
dashboard_projects_path
......
- page_title _('Invitation declined')
.decline-page.gl-display-flex.gl-flex-direction-column.gl-mx-auto{ class: 'gl-xs-w-full!' }
.gl-align-self-center.gl-mb-4.gl-mt-7.gl-sm-mt-0= sprite_icon('check-circle', size: 48, css_class: 'gl-text-green-400')
%h2.gl-font-size-h2= _('You successfully declined the invitation')
%p
= html_escape(_('We will notify %{inviter} that you declined their invitation to join GitLab. You will stop receiving reminders.')) % { inviter: sanitize_name(@member.created_by.name) }
%p
= _('You can now close this window.')
---
title: Add invitation declined page
merge_request: 43305
author:
type: changed
......@@ -13918,6 +13918,9 @@ msgstr ""
msgid "Invitation"
msgstr ""
msgid "Invitation declined"
msgstr ""
msgid "Invite"
msgstr ""
......@@ -28641,6 +28644,9 @@ msgstr ""
msgid "We want to be sure it is you, please confirm you are not a robot."
msgstr ""
msgid "We will notify %{inviter} that you declined their invitation to join GitLab. You will stop receiving reminders."
msgstr ""
msgid "We've found no vulnerabilities"
msgstr ""
......@@ -29252,6 +29258,9 @@ msgstr ""
msgid "You can notify the app / group or a project by sending them an email notification"
msgstr ""
msgid "You can now close this window."
msgstr ""
msgid "You can now export your security dashboard to a CSV report."
msgstr ""
......@@ -29501,6 +29510,9 @@ msgstr ""
msgid "You reached %{usage_in_percent} of %{namespace_name}'s storage capacity (%{used_storage} of %{storage_limit})"
msgstr ""
msgid "You successfully declined the invitation"
msgstr ""
msgid "You tried to fork %{link_to_the_project} but it failed for the following reason:"
msgstr ""
......
......@@ -81,10 +81,10 @@ RSpec.describe 'Group or Project invitations', :aggregate_failures do
end
end
context 'when inviting a user using their email address' do
context 'when inviting a user' do
let(:new_user) { build_stubbed(:user) }
let(:invite_email) { new_user.email }
let(:group_invite) { create(:group_member, :invited, group: group, invite_email: invite_email) }
let(:group_invite) { create(:group_member, :invited, group: group, invite_email: invite_email, created_by: owner) }
let!(:project_invite) { create(:project_member, :invited, project: project, invite_email: invite_email) }
context 'when user has not signed in yet' do
......@@ -210,30 +210,43 @@ RSpec.describe 'Group or Project invitations', :aggregate_failures do
context 'when declining the invitation' do
let(:send_email_confirmation) { true }
context 'when signed in' do
before do
sign_in(user)
visit invite_path(group_invite.raw_invite_token)
context 'as an existing user' do
let(:group_invite) { create(:group_member, user: user, group: group, created_by: owner) }
context 'when signed in' do
before do
sign_in(user)
visit decline_invite_path(group_invite.raw_invite_token)
end
it 'declines application and redirects to dashboard' do
expect(current_path).to eq(dashboard_projects_path)
expect(page).to have_content('You have declined the invitation to join group Owned.')
expect { group_invite.reload }.to raise_error ActiveRecord::RecordNotFound
end
end
it 'declines application and redirects to dashboard' do
page.click_link 'Decline'
context 'when signed out' do
before do
visit decline_invite_path(group_invite.raw_invite_token)
end
expect(current_path).to eq(dashboard_projects_path)
expect(page).to have_content('You have declined the invitation to join group Owned.')
expect { group_invite.reload }.to raise_error ActiveRecord::RecordNotFound
it 'declines application and redirects to sign in page' do
expect(current_path).to eq(new_user_session_path)
expect(page).to have_content('You have declined the invitation to join group Owned.')
expect { group_invite.reload }.to raise_error ActiveRecord::RecordNotFound
end
end
end
context 'when signed out' do
context 'as a non-existing user' do
before do
visit decline_invite_path(group_invite.raw_invite_token)
end
it 'declines application and redirects to sign in page' do
expect(current_path).to eq(new_user_session_path)
expect(page).to have_content('You have declined the invitation to join group Owned.')
it 'declines application and shows a decline page' do
expect(current_path).to eq(decline_invite_path(group_invite.raw_invite_token))
expect(page).to have_content('You successfully declined the invitation')
expect { group_invite.reload }.to raise_error ActiveRecord::RecordNotFound
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