Skip to content

Commit

Permalink
data_import: Add rocket chat import tool.
Browse files Browse the repository at this point in the history
This commit allows to import the following from rocketchat:
* All users
* All public/private channels
* All teams and its public/private channels
* All discussion rooms as topics in their parent channel
* All the messages in all the channels
* All private conversations
* Reactions on messages (except for custom emojis)
* Mentions in messages (except @ALL, @here mentions)
  • Loading branch information
garg3133 authored and timabbott committed Jul 28, 2021
1 parent 4161e0c commit 24dd0ff
Show file tree
Hide file tree
Showing 11 changed files with 1,463 additions and 0 deletions.
6 changes: 6 additions & 0 deletions zerver/data_import/import_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,8 @@ def build_user_profile(
realm_id: int,
short_name: str,
timezone: Optional[str],
is_bot: bool = False,
bot_type: Optional[int] = None,
) -> ZerverFieldsT:
obj = UserProfile(
avatar_source=avatar_source,
Expand All @@ -101,6 +103,8 @@ def build_user_profile(
role=role,
realm_id=realm_id,
timezone=timezone,
is_bot=is_bot,
bot_type=bot_type,
)
dct = model_to_dict(obj)

Expand Down Expand Up @@ -462,6 +466,7 @@ def build_stream(
stream_id: int,
deactivated: bool = False,
invite_only: bool = False,
stream_post_policy: int = 1,
) -> ZerverFieldsT:
stream = Stream(
name=name,
Expand All @@ -471,6 +476,7 @@ def build_stream(
date_created=date_created,
invite_only=invite_only,
id=stream_id,
stream_post_policy=stream_post_policy,
)
stream_dict = model_to_dict(stream, exclude=["realm"])
stream_dict["realm"] = realm_id
Expand Down
Loading

0 comments on commit 24dd0ff

Please sign in to comment.