Add success flash message for revoked portfolio invite and update flash message and translations to be generalized

This commit is contained in:
leigh-mil 2020-02-03 15:51:38 -05:00
parent ece4b20bcf
commit 41b2fff774
4 changed files with 18 additions and 11 deletions

View File

@ -467,9 +467,10 @@ def revoke_invite(application_id, application_role_id):
if invite.is_pending: if invite.is_pending:
ApplicationInvitations.revoke(invite.token) ApplicationInvitations.revoke(invite.token)
flash( flash(
"application_invite_revoked", "invite_revoked",
resource="Application",
user_name=app_role.user_name, user_name=app_role.user_name,
application_name=g.application.name, resource_name=g.application.name,
) )
else: else:
flash( flash(

View File

@ -37,8 +37,14 @@ def accept_invitation(portfolio_token):
) )
@user_can(Permissions.EDIT_PORTFOLIO_USERS, message="revoke invitation") @user_can(Permissions.EDIT_PORTFOLIO_USERS, message="revoke invitation")
def revoke_invitation(portfolio_id, portfolio_token): def revoke_invitation(portfolio_id, portfolio_token):
PortfolioInvitations.revoke(portfolio_token) invite = PortfolioInvitations.revoke(portfolio_token)
flash(
"invite_revoked",
resource="Portfolio",
user_name=invite.user_name,
resource_name=g.portfolio.name,
)
return redirect( return redirect(
url_for( url_for(
"portfolios.admin", "portfolios.admin",

View File

@ -33,11 +33,6 @@ MESSAGES = {
"message": "flash.application_invite.resent.message", "message": "flash.application_invite.resent.message",
"category": "success", "category": "success",
}, },
"application_invite_revoked": {
"title": "flash.application_invite.revoked.title",
"message": "flash.application_invite.revoked.message",
"category": "success",
},
"application_member_removed": { "application_member_removed": {
"title": "flash.application_member.removed.title", "title": "flash.application_member.removed.title",
"message": "flash.application_member.removed.message", "message": "flash.application_member.removed.message",
@ -103,6 +98,11 @@ MESSAGES = {
"message": None, "message": None,
"category": "warning", "category": "warning",
}, },
"invite_revoked": {
"title": "flash.invite_revoked.title",
"message": "flash.invite_revoked.message",
"category": "success",
},
"logged_out": { "logged_out": {
"title": "flash.logged_out.title", "title": "flash.logged_out.title",
"message": "flash.logged_out.message", "message": "flash.logged_out.message",

View File

@ -128,9 +128,6 @@ flash:
message: There was an error processing the invitation for {user_name} from {application_name} message: There was an error processing the invitation for {user_name} from {application_name}
resent: resent:
message: "{email} has been sent an invitation to access this Application" message: "{email} has been sent an invitation to access this Application"
revoked:
title: Application invitation revoked
message: You have successfully revoked the invite for {user_name} from {application_name}
application_member: application_member:
removed: removed:
title: Team member removed from application title: Team member removed from application
@ -166,6 +163,9 @@ flash:
errors: errors:
title: There were some errors title: There were some errors
message: Please see below. message: Please see below.
invite_revoked:
title: "{resource} invitation revoked"
message: "You have successfully revoked the invite for {user_name} from {resource_name}"
login_required_message: After you log in, you will be redirected to your destination page. login_required_message: After you log in, you will be redirected to your destination page.
login_required_title: Log in required login_required_title: Log in required
logged_out: logged_out: