mirror of
				https://github.com/zulip/zulip.git
				synced 2025-11-03 21:43:21 +00:00 
			
		
		
		
	remote_server_post_analytics: Change RealmDataForAnalytics.uuid type.
pydantic allows us to use UUID4 as a more accurate type.
This commit is contained in:
		
				
					committed by
					
						
						Tim Abbott
					
				
			
			
				
	
			
			
			
						parent
						
							c79f667116
						
					
				
				
					commit
					8695ffba49
				
			@@ -7,7 +7,7 @@ import requests
 | 
			
		||||
from django.conf import settings
 | 
			
		||||
from django.forms.models import model_to_dict
 | 
			
		||||
from django.utils.translation import gettext as _
 | 
			
		||||
from pydantic import BaseModel, ConfigDict
 | 
			
		||||
from pydantic import UUID4, BaseModel, ConfigDict
 | 
			
		||||
 | 
			
		||||
from analytics.models import InstallationCount, RealmCount
 | 
			
		||||
from version import ZULIP_VERSION
 | 
			
		||||
@@ -39,7 +39,7 @@ class RealmDataForAnalytics(BaseModel):
 | 
			
		||||
    date_created: float
 | 
			
		||||
    deactivated: bool
 | 
			
		||||
 | 
			
		||||
    uuid: str
 | 
			
		||||
    uuid: UUID4
 | 
			
		||||
    uuid_owner_secret: str
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@@ -191,7 +191,7 @@ def get_realms_info_for_push_bouncer() -> List[RealmDataForAnalytics]:
 | 
			
		||||
    realm_info_list = [
 | 
			
		||||
        RealmDataForAnalytics(
 | 
			
		||||
            id=realm.id,
 | 
			
		||||
            uuid=str(realm.uuid),
 | 
			
		||||
            uuid=realm.uuid,
 | 
			
		||||
            uuid_owner_secret=realm.uuid_owner_secret,
 | 
			
		||||
            host=realm.host,
 | 
			
		||||
            url=realm.uri,
 | 
			
		||||
 
 | 
			
		||||
@@ -531,7 +531,7 @@ def update_remote_realm_data_for_server(
 | 
			
		||||
    uuids = [realm["uuid"] for realm in server_realms_info]
 | 
			
		||||
    already_registered_remote_realms = RemoteRealm.objects.filter(uuid__in=uuids, server=server)
 | 
			
		||||
    already_registered_uuids = {
 | 
			
		||||
        str(remote_realm.uuid) for remote_realm in already_registered_remote_realms
 | 
			
		||||
        remote_realm.uuid for remote_realm in already_registered_remote_realms
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    new_remote_realms = [
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user