mirror of
https://github.com/zulip/zulip.git
synced 2025-11-16 03:41:58 +00:00
export: Support export of Custom Profile Field.
This commit is contained in:
@@ -15,8 +15,8 @@ from zerver.lib.avatar_hash import user_avatar_path_from_ids
|
||||
from zerver.models import UserProfile, Realm, Client, Huddle, Stream, \
|
||||
UserMessage, Subscription, Message, RealmEmoji, RealmFilter, \
|
||||
RealmDomain, Recipient, DefaultStream, get_user_profile_by_id, \
|
||||
UserPresence, UserActivity, UserActivityInterval, \
|
||||
get_display_recipient, Attachment, get_system_bot
|
||||
UserPresence, UserActivity, UserActivityInterval, CustomProfileField, \
|
||||
CustomProfileFieldValue, get_display_recipient, Attachment, get_system_bot
|
||||
from zerver.lib.parallel import run_parallel
|
||||
from typing import Any, Callable, Dict, List, Optional, Set, Tuple, \
|
||||
Iterable
|
||||
@@ -57,6 +57,8 @@ ALL_ZERVER_TABLES = [
|
||||
'zerver_attachment',
|
||||
'zerver_attachment_messages',
|
||||
'zerver_client',
|
||||
'zerver_customprofilefield',
|
||||
'zerver_customprofilefield_value',
|
||||
'zerver_defaultstream',
|
||||
'zerver_huddle',
|
||||
'zerver_message',
|
||||
@@ -387,6 +389,13 @@ def get_realm_config() -> Config:
|
||||
parent_key='realm_id__in',
|
||||
)
|
||||
|
||||
Config(
|
||||
table='zerver_customprofilefield',
|
||||
model=CustomProfileField,
|
||||
normal_parent=realm_config,
|
||||
parent_key='realm_id__in',
|
||||
)
|
||||
|
||||
Config(
|
||||
table='zerver_realmemoji',
|
||||
model=RealmEmoji,
|
||||
@@ -441,6 +450,13 @@ def get_realm_config() -> Config:
|
||||
parent_key='user_profile__in',
|
||||
)
|
||||
|
||||
Config(
|
||||
table='zerver_customprofilefield_value',
|
||||
model=CustomProfileFieldValue,
|
||||
normal_parent=user_profile_config,
|
||||
parent_key='user_profile__in',
|
||||
)
|
||||
|
||||
Config(
|
||||
table='zerver_useractivity',
|
||||
model=UserActivity,
|
||||
|
||||
@@ -513,10 +513,6 @@ def do_import_realm(import_dir: Path, subdomain: str) -> Realm:
|
||||
'useractivityinterval')
|
||||
bulk_import_model(data, UserActivityInterval, 'zerver_useractivityinterval')
|
||||
|
||||
if 'zerver_customprofilefield' in data:
|
||||
# As the export of Custom Profile fields is not supported, Zulip exported
|
||||
# data would not contain this field.
|
||||
# However this is supported in slack importer script
|
||||
re_map_foreign_keys(data, 'zerver_customprofilefield', 'realm', related_table="realm")
|
||||
update_model_ids(CustomProfileField, data, 'zerver_customprofilefield',
|
||||
related_table="customprofilefield")
|
||||
|
||||
Reference in New Issue
Block a user