diff --git a/atst/models/invitation.py b/atst/models/invitation.py index f65ff4da..3768849c 100644 --- a/atst/models/invitation.py +++ b/atst/models/invitation.py @@ -85,3 +85,7 @@ class Invitation(Base, TimestampsMixin, AuditableMixin): @property def user_email(self): return self.workspace_role.user.email + + @property + def user_name(self): + return self.workspace_role.user.full_name diff --git a/atst/routes/workspaces.py b/atst/routes/workspaces.py index 101a4e7c..c216d5ee 100644 --- a/atst/routes/workspaces.py +++ b/atst/routes/workspaces.py @@ -103,6 +103,7 @@ def show_workspace(workspace_id): def workspace_members(workspace_id): workspace = Workspaces.get_with_members(g.current_user, workspace_id) new_member_name = http_request.args.get("newMemberName") + resent_invitation_to = http_request.args.get("resentInvitationTo") new_member = next( filter(lambda m: m.user_name == new_member_name, workspace.members), None ) @@ -127,6 +128,7 @@ def workspace_members(workspace_id): status_choices=MEMBER_STATUSES, members=members_list, new_member=new_member, + resent_invitation_to=resent_invitation_to, ) @@ -380,4 +382,10 @@ def revoke_invitation(workspace_id, token): def resend_invitation(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, + resentInvitationTo=invite.user_name, + ) + ) diff --git a/templates/workspaces/members/index.html b/templates/workspaces/members/index.html index 9b0e1e5f..0c2c17a2 100644 --- a/templates/workspaces/members/index.html +++ b/templates/workspaces/members/index.html @@ -33,6 +33,17 @@ ) }} {% endif %} +{% if resent_invitation_to %} + {% set message -%} +

Successfully sent a new invitation to {{ resent_invitation_to }}.

+ {%- endset %} + + {{ Alert('Invitation resent', + message=message, + level='success' + ) }} +{% endif %} + {% set member_name = request.args.get("memberName") %} {% set updated_role = request.args.get("updatedRole") %} {% if updated_role %}