zulip/zerver
Alex Vandiver 2e50ead9d1 data_import: Fix bot email address de-duplication.
4815f6e28b 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.
2022-03-31 11:10:18 -07:00
..
data_import data_import: Fix bot email address de-duplication. 2022-03-31 11:10:18 -07:00
integration_fixtures/nagios tests: Add a test for fixtures for non-webhook integrations. 2021-04-28 08:16:51 -07:00
lib streams: Fix empty description in stream change notifications. 2022-03-29 01:39:55 -07:00
management management: Document logout_all_users interaction with API keys. 2022-03-24 14:58:31 -07:00
migrations python: Use modern set comprehension syntax. 2022-03-25 10:45:12 -07:00
openapi openapi: Allow empty value of stream's description. 2022-03-29 01:39:55 -07:00
tests data_import: Fix bot email address de-duplication. 2022-03-31 11:10:18 -07:00
tornado request: Add a var_name parameter to converter. 2022-03-15 13:02:02 -07:00
views streams: Fix empty description handling in new stream notifications. 2022-03-29 01:39:55 -07:00
webhooks beeminder: Accept float for payload["goal"]["pledge"]. 2022-03-22 21:08:48 -04:00
worker invite: Add backend support for "Never expires" option. 2022-02-24 16:32:19 -08:00
__init__.py django: Upgrade Zulip to Django 3.2 LTS. 2021-05-03 08:36:22 -07:00
apps.py caching: Make sender type optional for flush_cache. 2021-07-26 14:48:07 -07:00
context_processors.py home: Simplify and comment terms of service notice implementation. 2022-02-04 15:48:38 -08:00
decorator.py request: Add a var_name parameter to converter. 2022-03-15 13:02:02 -07:00
filters.py typing: Fix function signatures. 2021-08-20 05:54:19 -07:00
forms.py forms: Mark a bunch of error strings for translation. 2022-03-15 12:43:10 -07:00
logging_handlers.py python: Replace universal_newlines with text. 2022-01-23 22:16:01 -08:00
middleware.py docs: Fix many spelling mistakes. 2022-02-07 18:51:06 -08:00
models.py migrations: Adjust related_name settings for ArchivedAttachment. 2022-03-24 19:15:27 -07:00
signals.py signals: Lazily import zerver.actions. 2022-02-24 14:31:24 -08:00