Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
data_import: Fix bot email address de-duplication.
4815f6e tried to de-duplicate bot email addresses, but instead caused duplicates to crash: ``` Traceback (most recent call last): File "./manage.py", line 157, in <module> execute_from_command_line(sys.argv) File "./manage.py", line 122, in execute_from_command_line utility.execute() File "/srv/zulip-venv-cache/56ac6adf406011a100282dd526d03537be84d23e/zulip-py3-venv/lib/python3.8/site-packages/django/core/management/__init__.py", line 413, in execute self.fetch_command(subcommand).run_from_argv(self.argv) File "/srv/zulip-venv-cache/56ac6adf406011a100282dd526d03537be84d23e/zulip-py3-venv/lib/python3.8/site-packages/django/core/management/base.py", line 354, in run_from_argv self.execute(*args, **cmd_options) File "/srv/zulip-venv-cache/56ac6adf406011a100282dd526d03537be84d23e/zulip-py3-venv/lib/python3.8/site-packages/django/core/management/base.py", line 398, in execute output = self.handle(*args, **options) File "/home/zulip/deployments/2022-03-16-22-25-42/zerver/management/commands/convert_slack_data.py", line 59, in handle do_convert_data(path, output_dir, token, threads=num_threads) File "/home/zulip/deployments/2022-03-16-22-25-42/zerver/data_import/slack.py", line 1320, in do_convert_data ) = slack_workspace_to_realm( File "/home/zulip/deployments/2022-03-16-22-25-42/zerver/data_import/slack.py", line 141, in slack_workspace_to_realm ) = users_to_zerver_userprofile(slack_data_dir, user_list, realm_id, int(NOW), domain_name) File "/home/zulip/deployments/2022-03-16-22-25-42/zerver/data_import/slack.py", line 248, in users_to_zerver_userprofile email = get_user_email(user, domain_name) File "/home/zulip/deployments/2022-03-16-22-25-42/zerver/data_import/slack.py", line 406, in get_user_email return SlackBotEmail.get_email(user["profile"], domain_name) File "/home/zulip/deployments/2022-03-16-22-25-42/zerver/data_import/slack.py", line 85, in get_email email_prefix += cls.duplicate_email_count[email] TypeError: can only concatenate str (not "int") to str ``` Fix the stringification, make it case-insensitive, append with a dash for readability, and add tests for all of the above.
- Loading branch information