Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
unarchive_stream: Prevent unarchiving a stream in the wrong realm.
Alex Vandiverd834f1fc01ab
diff --git a/zerver/management/commands/unarchive_stream.py b/zerver/management/commands/unarchive_stream.pyindex e1987996664..0a553c3fe81 100644--- a/zerver/management/commands/unarchive_stream.py+++ b/zerver/management/commands/unarchive_stream.py@@ -43,6 +43,10 @@ class Command(ZulipBaseCommand):if options["stream_id"] is not None:stream = Stream.objects.get(id=options["stream_id"])+ if stream.realm_id != realm.id:+ raise CommandError(+ f"Stream id {stream.id}, named '{stream.name}', is in realm '{stream.realm.string_id}', not '{realm.string_id}'"+ )if not stream.deactivated:raise CommandError(f"Stream id {stream.id}, named '{stream.name}', is not deactivated"