From 02f2ae4048f5672fa06d3cb9a36b57d7dee0b821 Mon Sep 17 00:00:00 2001 From: Tim Abbott Date: Wed, 12 Dec 2018 12:56:14 -0800 Subject: [PATCH] slack import: Fix empty values for custom profile fields. The Slack import process would incorrectly issue CustomProfileFieldValue entries with a value of "" for users who didn't have a given CustomProfileField (especially common for the "skype" and "phone" fields). This had no user-visible effect, but certainly added some clutter in the database. --- zerver/data_import/slack.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/zerver/data_import/slack.py b/zerver/data_import/slack.py index 462862d6f5..43a9a1937c 100755 --- a/zerver/data_import/slack.py +++ b/zerver/data_import/slack.py @@ -263,6 +263,9 @@ def build_customprofilefields_values(custom_field_map: ZerverFieldsT, fields: Ze user_id: int, custom_field_id: int, custom_field_values: List[ZerverFieldsT]) -> int: for field, value in fields.items(): + if value['value'] == "": + # Skip writing entries for fields with an empty value + continue custom_field_value = CustomProfileFieldValue( id=custom_field_id, value=value['value'])