mirror of https://github.com/zulip/zulip.git
rename_stream: Move stream already has name check to view.
This commit is contained in:
parent
d059a0a90a
commit
ccdf17f47e
|
@ -2067,7 +2067,7 @@ def do_rename_stream(realm, old_name, new_name, log=True):
|
||||||
if not stream:
|
if not stream:
|
||||||
raise JsonableError(_('Unknown stream "%s"') % (old_name,))
|
raise JsonableError(_('Unknown stream "%s"') % (old_name,))
|
||||||
|
|
||||||
if get_stream(new_name, realm) and old_name.lower() != new_name.lower():
|
if get_stream(new_name, realm) is not None:
|
||||||
raise JsonableError(_('Stream name "%s" is already taken') % (new_name,))
|
raise JsonableError(_('Stream name "%s" is already taken') % (new_name,))
|
||||||
|
|
||||||
old_name = stream.name
|
old_name = stream.name
|
||||||
|
|
|
@ -98,7 +98,8 @@ def update_stream_backend(request, user_profile, stream_id,
|
||||||
new_name = new_name.strip()
|
new_name = new_name.strip()
|
||||||
# Will raise if the new name has invalid characters.
|
# Will raise if the new name has invalid characters.
|
||||||
check_stream_name(new_name)
|
check_stream_name(new_name)
|
||||||
|
if stream.name.lower() == new_name.lower():
|
||||||
|
return json_error(_("Stream already has that name!"))
|
||||||
do_rename_stream(user_profile.realm, stream.name, new_name)
|
do_rename_stream(user_profile.realm, stream.name, new_name)
|
||||||
if is_private is not None:
|
if is_private is not None:
|
||||||
do_change_stream_invite_only(stream, is_private)
|
do_change_stream_invite_only(stream, is_private)
|
||||||
|
|
Loading…
Reference in New Issue