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.

unarchive_stream: Fix logic checking for name collision.

Mateusz Mandera4681c6154d0a
diff --git a/zerver/management/commands/unarchive_channel.py b/zerver/management/commands/unarchive_channel.py
index 96edb6e9760..48186369788 100644
--- a/zerver/management/commands/unarchive_channel.py
+++ b/zerver/management/commands/unarchive_channel.py
@@ -90,7 +90,11 @@ class Command(ZulipBaseCommand):
else:
new_name = channel_name
- if Stream.objects.filter(realm=realm, name=new_name).exists():
+ if (
+ Stream.objects.filter(realm=realm, name__iexact=new_name)
+ .exclude(id=channel.id)
+ .exists()
+ ):
raise CommandError(
f"Channel with name '{new_name}' already exists; pass a different --new-name"
)