models: Add USER_ACTIVATED event type constant to RealmAuditLog.

This commit is contained in:
Vishnu Ks 2018-07-09 17:35:19 +05:30 committed by Tim Abbott
parent 2c8effe9fe
commit ce3fffdbb2
4 changed files with 4 additions and 3 deletions

View File

@ -937,7 +937,7 @@ class TestActiveUsersAudit(AnalyticsTestCase):
def test_event_types(self) -> None:
self.add_event(RealmAuditLog.USER_CREATED, 4)
self.add_event('user_deactivated', 3)
self.add_event('user_activated', 2)
self.add_event(RealmAuditLog.USER_ACTIVATED, 2)
self.add_event('user_reactivated', 1)
for i in range(4):
do_fill_count_stat_at_hour(self.stat, self.TIME_ZERO - i*self.DAY)

View File

@ -545,7 +545,7 @@ def do_activate_user(user_profile: UserProfile) -> None:
event_time = user_profile.date_joined
RealmAuditLog.objects.create(realm=user_profile.realm, modified_user=user_profile,
event_type='user_activated', event_time=event_time,
event_type=RealmAuditLog.USER_ACTIVATED, event_time=event_time,
requires_billing_update=activity_change_requires_seat_update(user_profile))
do_increment_logging_stat(user_profile.realm, COUNT_STATS['active_users_log:is_bot:day'],
user_profile.is_bot, event_time)

View File

@ -1963,6 +1963,7 @@ class RealmAuditLog(models.Model):
PLAN_UPDATE_QUANTITY = 'plan_update_quantity'
USER_CREATED = 'user_created'
USER_ACTIVATED = 'user_activated'
event_type = models.CharField(max_length=40) # type: str

View File

@ -28,7 +28,7 @@ class TestRealmAuditLog(ZulipTestCase):
realm=realm, acting_user=None, modified_user=user, modified_stream=None,
event_time__gte=now, event_time__lte=now+timedelta(minutes=60))
.order_by('event_time').values_list('event_type', flat=True))
self.assertEqual(event_types, [RealmAuditLog.USER_CREATED, 'user_deactivated', 'user_activated',
self.assertEqual(event_types, [RealmAuditLog.USER_CREATED, 'user_deactivated', RealmAuditLog.USER_ACTIVATED,
'user_deactivated', 'user_reactivated'])
def test_change_password(self) -> None: