From aad99ce951e3f999cff77f4d1a5344b421b96bd8 Mon Sep 17 00:00:00 2001 From: Tim Abbott Date: Sun, 3 Nov 2019 22:22:20 -0800 Subject: [PATCH] mattermost import: Fix handling of channels with no subscribers. Previously, we skipped setting the list of subscribers to the channel, which could result in problems if any messages had been posted there in the past (e.g. because the channel used to have members, but now doesn't). It could be correct to skip importing dead channels altogether, but probably simpler is to just set an empty subscriber list. --- zerver/data_import/mattermost.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/zerver/data_import/mattermost.py b/zerver/data_import/mattermost.py index 4e1500269d..c2aa125ea3 100644 --- a/zerver/data_import/mattermost.py +++ b/zerver/data_import/mattermost.py @@ -195,11 +195,10 @@ def convert_channel_data(channel_data: List[ZerverFieldsT], for username in channel_members_map[stream_name]: channel_users.add(user_id_mapper.get(username)) - if channel_users: - subscriber_handler.set_info( - users=channel_users, - stream_id=stream_id, - ) + subscriber_handler.set_info( + users=channel_users, + stream_id=stream_id, + ) streams.append(stream) return streams