Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
slack_importer: Move `get_data_file` to import util.
PieterCK485322cc7fd9
diff --git a/zerver/data_import/import_util.py b/zerver/data_import/import_util.pyindex f2908177b00..481b05ff9c2 100644--- a/zerver/data_import/import_util.py+++ b/zerver/data_import/import_util.py@@ -858,3 +858,9 @@ def validate_user_emails_for_import(user_emails: list[str]) -> None:def convert_html_to_text(content: str) -> str:# html2text is GPL licensed, so run it as a subprocess.return subprocess.check_output(["html2text", "--unicode-snob"], input=content, text=True)+++def get_data_file(path: str) -> Any:+ with open(path, "rb") as fp:+ data = orjson.loads(fp.read())+ return datadiff --git a/zerver/data_import/microsoft_teams.py b/zerver/data_import/microsoft_teams.pyindex a6a2a4e0b35..29170661c6d 100644--- a/zerver/data_import/microsoft_teams.py+++ b/zerver/data_import/microsoft_teams.py@@ -17,10 +17,10 @@ from zerver.data_import.import_util import (build_user_profile,build_zerver_realm,create_converted_data_files,+ get_data_file,validate_user_emails_for_import,)from zerver.data_import.sequencer import NEXT_ID-from zerver.data_import.slack import get_data_filefrom zerver.lib.export import do_common_export_processesfrom zerver.models.recipients import Recipientfrom zerver.models.users import UserProfilediff --git a/zerver/data_import/slack.py b/zerver/data_import/slack.pyindex 2231266c9c5..3bbe2554ec3 100644--- a/zerver/data_import/slack.py+++ b/zerver/data_import/slack.py@@ -37,6 +37,7 @@ from zerver.data_import.import_util import (build_usermessages,build_zerver_realm,create_converted_data_files,+ get_data_file,long_term_idle_helper,make_subscriber_map,process_avatars,@@ -1839,12 +1840,6 @@ def do_convert_directory(logging.info("Zulip data dump created at %s", output_dir)-def get_data_file(path: str) -> Any:- with open(path, "rb") as fp:- data = orjson.loads(fp.read())- return data--def check_slack_token_access(token: str, required_scopes: set[str]) -> None:if token.startswith("xoxp-"):logging.info("This is a Slack user token, which grants all rights the user has!")