mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-02-05 02:42:26 -05:00
Added from_user name and service name for the cancelled invitation message.
This commit is contained in:
@@ -9,6 +9,7 @@ from flask import (
|
||||
from notifications_python_client.errors import HTTPError
|
||||
|
||||
from app.main import main
|
||||
from app.main.dao.services_dao import get_service_by_id_or_404
|
||||
from app import (
|
||||
invite_api_client,
|
||||
user_api_client
|
||||
@@ -22,7 +23,11 @@ def accept_invite(token):
|
||||
|
||||
invited_user = invite_api_client.check_token(token)
|
||||
if invited_user.status == 'cancelled':
|
||||
return render_template('views/cancelled-invitation.html')
|
||||
from_user = user_api_client.get_user(invited_user.from_user)
|
||||
service = get_service_by_id_or_404(invited_user.service)
|
||||
return render_template('views/cancelled-invitation.html',
|
||||
from_user=from_user.name,
|
||||
service_name=service['name'])
|
||||
|
||||
existing_user = user_api_client.get_user_by_email(invited_user.email_address)
|
||||
|
||||
|
||||
@@ -4,10 +4,13 @@
|
||||
<div class="grid-row">
|
||||
<div class="column-two-thirds">
|
||||
<h1 class="heading-large">
|
||||
The invitation you were sent has been cancelled.
|
||||
The invitation you were sent has been cancelled
|
||||
</h1>
|
||||
<p>
|
||||
The person that sent you the invitation decided that it was sent in error and has cancelled the invitation.
|
||||
{{ from_user }} decided to cancel this invitation.
|
||||
</p>
|
||||
<p>
|
||||
If you need access to {{ service_name }}, you’ll have to ask them to invite you again.
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -83,7 +83,9 @@ def test_new_user_accept_invite_calls_api_and_redirects_to_registration(app_,
|
||||
|
||||
def test_cancelled_invited_user_accepts_invited_redirect_to_cancelled_invitation(app_,
|
||||
service_one,
|
||||
mocker
|
||||
mocker,
|
||||
mock_get_user,
|
||||
mock_get_service
|
||||
):
|
||||
with app_.test_request_context():
|
||||
with app_.test_client() as client:
|
||||
@@ -93,7 +95,8 @@ def test_cancelled_invited_user_accepts_invited_redirect_to_cancelled_invitation
|
||||
|
||||
app.invite_api_client.check_token.assert_called_with('thisisnotarealtoken')
|
||||
assert response.status_code == 200
|
||||
assert 'Invitation has been cancelled' in response.get_data(as_text=True)
|
||||
page = BeautifulSoup(response.data.decode('utf-8'), 'html.parser')
|
||||
assert page.h1.string.strip() == 'The invitation you were sent has been cancelled'
|
||||
|
||||
|
||||
def test_new_user_accept_invite_completes_new_registration_redirects_to_verify(app_,
|
||||
|
||||
Reference in New Issue
Block a user