Fix typo and add flash message for when invite can't be revoked

This commit is contained in:
leigh-mil 2019-09-23 11:43:17 -04:00
parent 663fb9f288
commit 05aca75679
2 changed files with 14 additions and 1 deletions

View File

@ -386,7 +386,9 @@ def update_member(application_id, application_role_id):
"/applications/<application_id>/members/<application_role_id>/revoke_invite",
methods=["POST"],
)
@user_can(Permissions.DELETE_APPLICATION_MEMBER, message="revoke appliction invitation")
@user_can(
Permissions.DELETE_APPLICATION_MEMBER, message="revoke application invitation"
)
def revoke_invite(application_id, application_role_id):
app_role = ApplicationRoles.get_by_id(application_role_id)
invite = app_role.latest_invitation
@ -398,6 +400,12 @@ def revoke_invite(application_id, application_role_id):
user_name=app_role.user_name,
application_name=g.application.name,
)
else:
flash(
"application_invite_error",
user_name=app_role.user_name,
application_name=g.application.name,
)
return redirect(
url_for(

View File

@ -27,6 +27,11 @@ MESSAGES = {
"message_template": "Application environments have been updated",
"category": "success",
},
"application_invite_error": {
"title_template": "Application invitation error",
"message_template": "There was an error processing the invitation for {{ user_name }} from {{ application_name }}",
"category": "error",
},
"application_invite_revoked": {
"title_template": "Application invitation revoked",
"message_template": "You have successfully revoked the invite for {{ user_name }} from {{ application_name }}",