stages/invitation: remove invitation from plan context after deletion

Signed-off-by: Jens Langhammer <jens.langhammer@beryju.org>
This commit is contained in:
Jens Langhammer 2021-11-02 23:50:12 +01:00
parent cb64eed90d
commit f978575293
1 changed files with 5 additions and 3 deletions

View File

@ -79,7 +79,9 @@ class InvitationFinalStageView(StageView):
if not invitation:
LOGGER.warning("InvitationFinalStageView stage called without invitation")
return HttpResponseBadRequest
if not invitation.single_use:
return self.executor.stage_ok()
invitation.delete()
token = invitation.invite_uuid.hex
if invitation.single_use:
invitation.delete()
LOGGER.debug("Deleted invitation", token=token)
del self.executor.plan.context[INVITATION]
return self.executor.stage_ok()