Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
mattermost_importer: Fix guest users not subscribed to any channels.
PieterCK39a0d7a65828
diff --git a/zerver/data_import/mattermost.py b/zerver/data_import/mattermost.pyindex 1fee0066bac..caf53ecc2a6 100644--- a/zerver/data_import/mattermost.py+++ b/zerver/data_import/mattermost.py@@ -216,6 +216,8 @@ def convert_channel_data(channel_admins_map[mattermost_channel_id].append(username)elif "channel_user" in channel_roles:channel_members_map[mattermost_channel_id].append(username)+ elif "channel_guest" in channel_roles:+ channel_members_map[mattermost_channel_id].append(username)def get_invite_only_value_from_channel_type(channel_type: str) -> bool:# Channel can have two types in Mattermostdiff --git a/zerver/tests/test_mattermost_importer.py b/zerver/tests/test_mattermost_importer.pyindex f22ef9d5dfb..cef5d9d9a32 100644--- a/zerver/tests/test_mattermost_importer.py+++ b/zerver/tests/test_mattermost_importer.py@@ -192,7 +192,6 @@ class MattermostImportTestBase(ZulipTestCase):mattermost_data: dict[str, Any],imported_realm: Any,exported_channel_subscriber_dict: dict[str, set[str]],- excluded_user_emails: set[str],) -> None:for channel_data in mattermost_data["channel"]:channel_name = channel_data["display_name"]@@ -202,11 +201,7 @@ class MattermostImportTestBase(ZulipTestCase):self.assertEqual(imported_channel.description, channel_data["purpose"])self.assertEqual(imported_channel.invite_only, channel_data["type"] == "P")- # TODO: We convert guest users but don't properly subscribe them to the- # channels they follow.- expected_subscribers = set(- exported_channel_subscriber_dict[mattermost_channel_id]- ).difference(excluded_user_emails)+ expected_subscribers = set(exported_channel_subscriber_dict[mattermost_channel_id])self.assertSetEqual(expected_subscribers,@@ -1583,7 +1578,6 @@ class MattermostV1110ImportTest(MattermostImportTestBase):mattermost_data=mattermost_data,imported_realm=imported_realm,exported_channel_subscriber_dict=user_map_data.exported_channel_subscriber_dict,- excluded_user_emails=self.GUEST_EMAILS,)with self.subTest("test channel message conversion"):