mirror of
				https://github.com/zulip/zulip.git
				synced 2025-11-04 05:53:43 +00:00 
			
		
		
		
	server_initialization: Rename some variables.
This makes the code of create_internal_realm identical to the corresponding block in initialize_voyager_db.py.
This commit is contained in:
		
				
					committed by
					
						
						Tim Abbott
					
				
			
			
				
	
			
			
			
						parent
						
							2f17911310
						
					
				
				
					commit
					68abddb534
				
			@@ -8,17 +8,17 @@ from zerver.models import Realm, UserProfile, email_to_username, get_client, \
 | 
			
		||||
from typing import Iterable, Optional, Tuple
 | 
			
		||||
 | 
			
		||||
def create_internal_realm() -> None:
 | 
			
		||||
    internal_realm = Realm.objects.create(string_id=settings.SYSTEM_BOT_REALM)
 | 
			
		||||
    realm = Realm.objects.create(string_id=settings.SYSTEM_BOT_REALM)
 | 
			
		||||
 | 
			
		||||
    # Create the "website" and "API" clients:
 | 
			
		||||
    get_client("website")
 | 
			
		||||
    get_client("API")
 | 
			
		||||
 | 
			
		||||
    internal_realm_bots = [(bot['name'], bot['email_template'] % (settings.INTERNAL_BOT_DOMAIN,))
 | 
			
		||||
    internal_bots = [(bot['name'], bot['email_template'] % (settings.INTERNAL_BOT_DOMAIN,))
 | 
			
		||||
                     for bot in settings.INTERNAL_BOTS]
 | 
			
		||||
    create_users(internal_realm, internal_realm_bots, bot_type=UserProfile.DEFAULT_BOT)
 | 
			
		||||
    create_users(realm, internal_bots, bot_type=UserProfile.DEFAULT_BOT)
 | 
			
		||||
    # Set the owners for these bots to the bots themselves
 | 
			
		||||
    bots = UserProfile.objects.filter(email__in=[bot_info[1] for bot_info in internal_realm_bots])
 | 
			
		||||
    bots = UserProfile.objects.filter(email__in=[bot_info[1] for bot_info in internal_bots])
 | 
			
		||||
    for bot in bots:
 | 
			
		||||
        bot.bot_owner = bot
 | 
			
		||||
        bot.save()
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user