Send an email
This commit is contained in:
parent
2f1970e93b
commit
016116c9cc
@ -81,3 +81,7 @@ class Invitation(Base, TimestampsMixin, AuditableMixin):
|
|||||||
def workspace(self):
|
def workspace(self):
|
||||||
if self.workspace_role:
|
if self.workspace_role:
|
||||||
return self.workspace_role.workspace
|
return self.workspace_role.workspace
|
||||||
|
|
||||||
|
@property
|
||||||
|
def user_email(self):
|
||||||
|
return self.workspace_role.user.email
|
||||||
|
@ -378,5 +378,8 @@ def revoke_invitation(workspace_id, token):
|
|||||||
|
|
||||||
@bp.route("/workspaces/<workspace_id>/invitations/<token>/resend", methods=["POST"])
|
@bp.route("/workspaces/<workspace_id>/invitations/<token>/resend", methods=["POST"])
|
||||||
def resend_invitation(workspace_id, token):
|
def resend_invitation(workspace_id, token):
|
||||||
Invitations.resend(g.current_user, workspace_id, token)
|
invite = Invitations.resend(g.current_user, workspace_id, token)
|
||||||
|
send_invite_email(
|
||||||
|
g.current_user.full_name, invite.token, invite.user_email
|
||||||
|
)
|
||||||
return redirect(url_for("workspaces.workspace_members", workspace_id=workspace_id))
|
return redirect(url_for("workspaces.workspace_members", workspace_id=workspace_id))
|
||||||
|
@ -457,3 +457,22 @@ def test_revoke_invitation(client, user_session):
|
|||||||
|
|
||||||
assert response.status_code == 302
|
assert response.status_code == 302
|
||||||
assert invite.is_revoked
|
assert invite.is_revoked
|
||||||
|
|
||||||
|
|
||||||
|
def test_resend_invitation_sends_email(client, user_session, queue):
|
||||||
|
user = UserFactory.create()
|
||||||
|
workspace = WorkspaceFactory.create()
|
||||||
|
ws_role = WorkspaceRoleFactory.create(
|
||||||
|
user=user, workspace=workspace, status=WorkspaceRoleStatus.PENDING
|
||||||
|
)
|
||||||
|
invite = InvitationFactory.create(
|
||||||
|
user_id=user.id,
|
||||||
|
workspace_role_id=ws_role.id,
|
||||||
|
status=InvitationStatus.PENDING,
|
||||||
|
)
|
||||||
|
user_session(workspace.owner)
|
||||||
|
client.post(
|
||||||
|
url_for("workspaces.resend_invitation", workspace_id=workspace.id, token=invite.token)
|
||||||
|
)
|
||||||
|
|
||||||
|
assert len(queue.get_queue()) == 1
|
||||||
|
Loading…
x
Reference in New Issue
Block a user