stages/invitation: remove invitation_created signal as model_created functions the same

This commit is contained in:
Jens Langhammer
2020-12-24 16:44:17 +01:00
parent d47d9103c7
commit 49eb568d3c
5 changed files with 2 additions and 17 deletions

View File

@ -35,7 +35,6 @@ class EventAction(models.TextChoices):
TOKEN_VIEW = "token_view" # nosec
INVITE_CREATED = "invitation_created"
INVITE_USED = "invitation_used"
AUTHORIZE_APPLICATION = "authorize_application"

View File

@ -14,7 +14,7 @@ from authentik.core.models import User
from authentik.core.signals import password_changed
from authentik.events.models import Event, EventAction
from authentik.stages.invitation.models import Invitation
from authentik.stages.invitation.signals import invitation_created, invitation_used
from authentik.stages.invitation.signals import invitation_used
from authentik.stages.user_write.signals import user_write
@ -79,16 +79,6 @@ def on_user_login_failed(
thread.run()
@receiver(invitation_created)
# pylint: disable=unused-argument
def on_invitation_created(sender, request: HttpRequest, invitation: Invitation, **_):
"""Log Invitation creation"""
thread = EventNewThread(
EventAction.INVITE_CREATED, request, invitation_uuid=invitation.invite_uuid.hex
)
thread.run()
@receiver(invitation_used)
# pylint: disable=unused-argument
def on_invitation_used(sender, request: HttpRequest, invitation: Invitation, **_):

View File

@ -28,7 +28,7 @@ def cleanse_dict(source: Dict[Any, Any]) -> Dict[Any, Any]:
final_dict[key] = SafeExceptionReporterFilter.cleansed_substitute
else:
final_dict[key] = value
except TypeError:
except TypeError: # pragma: no cover
final_dict[key] = value
if isinstance(value, dict):
final_dict[key] = cleanse_dict(value)