mirror of
https://github.com/zulip/zulip.git
synced 2025-11-19 14:08:23 +00:00
do_change_stream_description: Accept a stream as argument.
This commit is contained in:
@@ -2115,14 +2115,13 @@ def do_rename_stream(stream, new_name, log=True):
|
||||
# email forwarding address to display the correctly-escaped new name.
|
||||
return {"email_address": new_email}
|
||||
|
||||
def do_change_stream_description(realm, stream_name, new_description):
|
||||
# type: (Realm, Text, Text) -> None
|
||||
stream = get_stream(stream_name, realm)
|
||||
def do_change_stream_description(stream, new_description):
|
||||
# type: (Stream, Text) -> None
|
||||
stream.description = new_description
|
||||
stream.save(update_fields=['description'])
|
||||
|
||||
event = dict(type='stream', op='update',
|
||||
property='description', name=stream_name,
|
||||
property='description', name=stream.name,
|
||||
value=new_description)
|
||||
send_event(event, can_access_stream_user_ids(stream))
|
||||
|
||||
|
||||
@@ -1053,7 +1053,7 @@ class EventsRegisterTest(ZulipTestCase):
|
||||
error = add_schema_checker('events[1]', events[1])
|
||||
self.assert_on_error(error)
|
||||
|
||||
action = lambda: do_change_stream_description(get_realm('zulip'), 'test_stream', u'new description')
|
||||
action = lambda: do_change_stream_description(stream, u'new description')
|
||||
events = self.do_test(action)
|
||||
error = stream_update_schema_checker('events[0]', events[0])
|
||||
self.assert_on_error(error)
|
||||
|
||||
@@ -93,7 +93,7 @@ def update_stream_backend(request, user_profile, stream_id,
|
||||
(stream, recipient, sub) = access_stream_by_id(user_profile, stream_id)
|
||||
|
||||
if description is not None:
|
||||
do_change_stream_description(user_profile.realm, stream.name, description)
|
||||
do_change_stream_description(stream, description)
|
||||
if new_name is not None:
|
||||
new_name = new_name.strip()
|
||||
# Will raise if the new name has invalid characters.
|
||||
|
||||
Reference in New Issue
Block a user