rocketchat: Validate custom emoji before larger data sets.

This is a data set that's relatively likely to have weird failures,
and also likely to be fairly small.
This commit is contained in:
Tim Abbott 2024-10-17 11:31:13 -07:00
parent 6e4da50577
commit 010410c849
2 changed files with 11 additions and 11 deletions

View File

@ -1107,6 +1107,16 @@ def do_convert_data(rocketchat_data_dir: str, output_dir: str) -> None:
user_id_mapper=user_id_mapper,
)
rocketchat_emoji_data = rocketchat_data_to_dict(rocketchat_data_dir, ["custom_emoji"])[
"custom_emoji"
]
zerver_realmemoji = build_custom_emoji(
realm_id=realm_id,
custom_emoji_data=rocketchat_emoji_data,
output_dir=output_dir,
)
realm["zerver_realmemoji"] = zerver_realmemoji
room_id_to_room_map: dict[str, dict[str, Any]] = {}
team_id_to_team_map: dict[str, dict[str, Any]] = {}
dsc_id_to_dsc_map: dict[str, dict[str, Any]] = {}
@ -1181,16 +1191,6 @@ def do_convert_data(rocketchat_data_dir: str, output_dir: str) -> None:
)
realm["zerver_subscription"] = zerver_subscription
rocketchat_emoji_data = rocketchat_data_to_dict(rocketchat_data_dir, ["custom_emoji"])[
"custom_emoji"
]
zerver_realmemoji = build_custom_emoji(
realm_id=realm_id,
custom_emoji_data=rocketchat_emoji_data,
output_dir=output_dir,
)
realm["zerver_realmemoji"] = zerver_realmemoji
subscriber_map = make_subscriber_map(
zerver_subscription=zerver_subscription,
)

View File

@ -908,9 +908,9 @@ class RocketChatImporter(ZulipTestCase):
self.assertEqual(
info_log.output,
[
"INFO:root:Direct message group channel found. UIDs: ['LdBZ7kPxtKESyHPEe', 'M2sXGqoQRJQwQoXY2', 'os6N2Xg2JkNMCSW9Z']",
"INFO:root:Starting to process custom emoji",
"INFO:root:Done processing emoji",
"INFO:root:Direct message group channel found. UIDs: ['LdBZ7kPxtKESyHPEe', 'M2sXGqoQRJQwQoXY2', 'os6N2Xg2JkNMCSW9Z']",
"INFO:root:skipping direct messages discussion mention: Discussion with Hermione",
],
)