feat: update user segment attribute is_disabled when user is disabled/enabled (#36681)

This commit is contained in:
Eemaan Amir
2025-05-09 19:35:16 +05:00
committed by GitHub
parent 8758007e9b
commit 841efcc9fb
2 changed files with 7 additions and 1 deletions

View File

@@ -36,6 +36,7 @@ from rest_framework.viewsets import ViewSet
from wiki.models import ArticleRevision
from wiki.models.pluginbase import RevisionPluginRevision
from common.djangoapps.track import segment
from common.djangoapps.entitlements.models import CourseEntitlement
from common.djangoapps.student.models import ( # lint-amnesty, pylint: disable=unused-import
CourseEnrollmentAllowed,
@@ -510,7 +511,9 @@ class AccountDeactivationView(APIView):
Marks the user as having no password set for deactivation purposes.
"""
_set_unusable_password(User.objects.get(username=username))
user = User.objects.get(username=username)
segment.identify(user.id, {'is_disabled': 'true'})
_set_unusable_password(user)
return Response(get_account_settings(request, [username])[0])