diff --git a/zerver/lib/soft_deactivation.py b/zerver/lib/soft_deactivation.py index a589ba0a5f..d958867879 100644 --- a/zerver/lib/soft_deactivation.py +++ b/zerver/lib/soft_deactivation.py @@ -197,7 +197,7 @@ def maybe_catch_up_soft_deactivated_user(user_profile: UserProfile) -> Union[Use RealmAuditLog.objects.create( realm=user_profile.realm, modified_user=user_profile, - event_type='user_soft_activated', + event_type=RealmAuditLog.USER_SOFT_ACTIVATED, event_time=timezone_now() ) logger.info('Soft Reactivated user %s (%s)' % diff --git a/zerver/models.py b/zerver/models.py index 80ba8382f5..373a0a74d9 100644 --- a/zerver/models.py +++ b/zerver/models.py @@ -1965,6 +1965,7 @@ class RealmAuditLog(models.Model): USER_ACTIVATED = 'user_activated' USER_DEACTIVATED = 'user_deactivated' USER_REACTIVATED = 'user_reactivated' + USER_SOFT_ACTIVATED = 'user_soft_activated' USER_CHANGE_PASSWORD = 'user_change_password' USER_CHANGE_AVATAR_SOURCE = 'user_change_avatar_source' USER_FULL_NAME_CHANGED = 'user_full_name_changed' diff --git a/zerver/tests/test_messages.py b/zerver/tests/test_messages.py index 0b4f059006..9e0b47bbbe 100644 --- a/zerver/tests/test_messages.py +++ b/zerver/tests/test_messages.py @@ -2913,7 +2913,7 @@ class SoftDeactivationMessageTest(ZulipTestCase): self.assert_length(queries, 7) self.assertFalse(long_term_idle_user.long_term_idle) self.assertEqual(last_realm_audit_log_entry( - 'user_soft_activated').modified_user, long_term_idle_user) + RealmAuditLog.USER_SOFT_ACTIVATED).modified_user, long_term_idle_user) idle_user_msg_list = get_user_messages(long_term_idle_user) self.assertEqual(len(idle_user_msg_list), idle_user_msg_count + 1) self.assertEqual(idle_user_msg_list[-1].content, message)