import: Handle corner case around EMAIL_GATEWAY_BOT emails.

This commit is contained in:
Tim Abbott
2019-01-02 14:44:47 -08:00
parent 8cfea958de
commit b63f8b59b2

View File

@@ -718,6 +718,10 @@ def do_import_realm(import_dir: Path, subdomain: str) -> Realm:
# Remap the user IDs for notification_bot and friends to their
# appropriate IDs on this server
for item in data['zerver_userprofile_crossrealm']:
if item['email'].startswith("emailgateway@"):
# The email gateway bot's email is customized to a
# different domain on some servers.
item['email'] = settings.EMAIL_GATEWAY_BOT
logging.info("Adding to ID map: %s %s" % (item['id'], get_system_bot(item['email']).id))
new_user_id = get_system_bot(item['email']).id
update_id_map(table='user_profile', old_id=item['id'], new_id=new_user_id)