Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
export: Only include real, active humans in the displayed count.
Alex Vandiverf4eae83542fe
diff --git a/zerver/management/commands/export.py b/zerver/management/commands/export.pyindex 6ad07a2b23b..c83f5bbd4b3 100644--- a/zerver/management/commands/export.py+++ b/zerver/management/commands/export.py@@ -144,8 +144,16 @@ class Command(ZulipBaseCommand):print(f"\n\033[94mMessage content:\033[0m\n{message.content}\n")- user_count = UserProfile.objects.filter(realm_id=realm.id).count()- print(f"\033[94mNumber of users that reacted outbox:\033[0m {len(reactions)} / {user_count} total users\n")+ user_count = UserProfile.objects.filter(+ realm_id=realm.id,+ is_active=True,+ is_bot=False,+ ).exclude(+ # We exclude guests, because they're not a priority for+ # looking at whether most users are being exported.+ role=UserProfile.ROLE_GUEST,+ ).count()+ print(f"\033[94mNumber of users that reacted outbox:\033[0m {len(reactions)} / {user_count} total non-guest users\n")proceed = input("Continue? [y/N] ")if proceed.lower() not in ('y', 'yes'):diff --git a/zerver/tests/test_management_commands.py b/zerver/tests/test_management_commands.pyindex b2f80b45c78..1a4a631d6b2 100644--- a/zerver/tests/test_management_commands.py+++ b/zerver/tests/test_management_commands.py@@ -459,7 +459,7 @@ class TestExport(ZulipTestCase):self.assertEqual(mock_print.mock_calls, [call('\033[94mExporting realm\033[0m: zulip'),call('\n\033[94mMessage content:\033[0m\nOutbox emoji for export\n'),- call('\033[94mNumber of users that reacted outbox:\033[0m 2 / 13 total users\n'),+ call('\033[94mNumber of users that reacted outbox:\033[0m 2 / 8 total non-guest users\n'),])with self.assertRaisesRegex(CommandError, "Message with given ID does not"), \