mirror of
https://github.com/zulip/zulip.git
synced 2025-11-15 11:22:04 +00:00
models: Add BOT_OWNER_CHANGED event type constant to RealmAuditLog.
This commit is contained in:
@@ -2832,7 +2832,7 @@ def do_change_bot_owner(user_profile: UserProfile, bot_owner: UserProfile,
|
||||
user_profile.save() # Can't use update_fields because of how the foreign key works.
|
||||
event_time = timezone_now()
|
||||
RealmAuditLog.objects.create(realm=user_profile.realm, acting_user=acting_user,
|
||||
modified_user=user_profile, event_type='bot_owner_changed',
|
||||
modified_user=user_profile, event_type=RealmAuditLog.BOT_OWNER_CHANGED,
|
||||
event_time=event_time)
|
||||
|
||||
update_users = bot_owner_user_ids(user_profile)
|
||||
|
||||
@@ -1976,6 +1976,8 @@ class RealmAuditLog(models.Model):
|
||||
REALM_DEACTIVATED = 'realm_deactivated'
|
||||
REALM_REACTIVATED = 'realm_reactivated'
|
||||
|
||||
BOT_OWNER_CHANGED = 'bot_owner_changed'
|
||||
|
||||
event_type = models.CharField(max_length=40) # type: str
|
||||
|
||||
def __str__(self) -> str:
|
||||
|
||||
@@ -88,7 +88,7 @@ class TestRealmAuditLog(ZulipTestCase):
|
||||
bot = self.notification_bot()
|
||||
bot_owner = self.example_user('hamlet')
|
||||
do_change_bot_owner(bot, bot_owner, admin)
|
||||
self.assertEqual(RealmAuditLog.objects.filter(event_type='bot_owner_changed',
|
||||
self.assertEqual(RealmAuditLog.objects.filter(event_type=RealmAuditLog.BOT_OWNER_CHANGED,
|
||||
event_time__gte=now).count(), 1)
|
||||
self.assertEqual(bot_owner, bot.bot_owner)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user