chore: delete workspace invitation on user deactivation (#4514)

This commit is contained in:
Nikhil 2024-05-20 12:29:49 +05:30 committed by GitHub
parent e951cc3cf4
commit efe62bccf3
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -25,6 +25,7 @@ from plane.db.models import (
ProjectMember, ProjectMember,
User, User,
WorkspaceMember, WorkspaceMember,
WorkspaceMemberInvite,
) )
from plane.license.models import Instance, InstanceAdmin from plane.license.models import Instance, InstanceAdmin
from plane.utils.cache import cache_response, invalidate_cache from plane.utils.cache import cache_response, invalidate_cache
@ -154,6 +155,11 @@ class UserEndpoint(BaseViewSet):
workspaces_to_deactivate, ["is_active"], batch_size=100 workspaces_to_deactivate, ["is_active"], batch_size=100
) )
# Delete all workspace invites
WorkspaceMemberInvite.objects.filter(
email=user.email,
).delete()
# Deactivate the user # Deactivate the user
user.is_active = False user.is_active = False