Skip to content

armgit / zulip

Public Imported from GitHub
0

Zulip server and web application. Open-source team chat that helps teams stay productive and focused.

export: Show total number of users in the realm as well.

Alex Vandivere3ba79b9df95
diff --git a/zerver/management/commands/export.py b/zerver/management/commands/export.py
index d0e10273113..129ad6883d0 100644
--- a/zerver/management/commands/export.py
+++ b/zerver/management/commands/export.py
@@ -9,7 +9,7 @@ from django.core.management.base import CommandError
from zerver.lib.export import export_realm_wrapper
from zerver.lib.management import ZulipBaseCommand
-from zerver.models import Message, Reaction
+from zerver.models import Message, Reaction, UserProfile
class Command(ZulipBaseCommand):
@@ -149,7 +149,8 @@ class Command(ZulipBaseCommand):
print(f"\n\033[94mMessage content:\033[0m\n{message.content}\n")
- print(f"\033[94mNumber of users that reacted outbox:\033[0m {len(reactions)}\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")
if output_dir is None:
output_dir = tempfile.mkdtemp(prefix="zulip-export-")
diff --git a/zerver/tests/test_management_commands.py b/zerver/tests/test_management_commands.py
index 053ba07e8de..7bb495d2f8f 100644
--- a/zerver/tests/test_management_commands.py
+++ b/zerver/tests/test_management_commands.py
@@ -457,7 +457,7 @@ class TestExport(ZulipTestCase):
self.assertEqual(mock_print.mock_calls, [
call('\033[94mExporting realm\033[0m: zulip'),
call('\n\033[94mMessage content:\033[0m\nThumbs up for export\n'),
- call('\033[94mNumber of users that reacted outbox:\033[0m 2\n')
+ call('\033[94mNumber of users that reacted outbox:\033[0m 2 / 13 total users\n'),
])
with self.assertRaisesRegex(CommandError, "Message with given ID does not"), \