mirror of
https://github.com/zulip/zulip.git
synced 2025-11-17 04:12:02 +00:00
Add events for bot avatar_url changes
(imported from commit c058386ce5ef9d89165c44fd853808cfe1f625f4)
This commit is contained in:
@@ -1349,6 +1349,13 @@ def do_change_avatar_source(user_profile, avatar_source, log=True):
|
|||||||
'user': user_profile.email,
|
'user': user_profile.email,
|
||||||
'avatar_source': avatar_source})
|
'avatar_source': avatar_source})
|
||||||
|
|
||||||
|
if user_profile.is_bot:
|
||||||
|
send_event(dict(type='realm_bot',
|
||||||
|
op='update',
|
||||||
|
bot=dict(email=user_profile.email,
|
||||||
|
avatar_url=avatar_url(user_profile),)),
|
||||||
|
bot_owner_userids(user_profile))
|
||||||
|
|
||||||
def _default_stream_permision_check(user_profile, stream):
|
def _default_stream_permision_check(user_profile, stream):
|
||||||
# Any user can have a None default stream
|
# Any user can have a None default stream
|
||||||
if stream is not None:
|
if stream is not None:
|
||||||
|
|||||||
@@ -25,6 +25,7 @@ from zerver.lib.actions import (
|
|||||||
do_update_pointer,
|
do_update_pointer,
|
||||||
do_create_user,
|
do_create_user,
|
||||||
do_regenerate_api_key,
|
do_regenerate_api_key,
|
||||||
|
do_change_avatar_source,
|
||||||
fetch_initial_state_data,
|
fetch_initial_state_data,
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -296,6 +297,12 @@ class EventsRegisterTest(AuthedTestCase):
|
|||||||
error = self.build_update_checker('api_key', check_string)('events[0]', events[0])
|
error = self.build_update_checker('api_key', check_string)('events[0]', events[0])
|
||||||
self.assert_on_error(error)
|
self.assert_on_error(error)
|
||||||
|
|
||||||
|
def test_change_bot_avatar_source(self):
|
||||||
|
action = lambda: do_change_avatar_source(self.bot, self.bot.AVATAR_FROM_USER)
|
||||||
|
events = self.do_test(action)
|
||||||
|
error = self.build_update_checker('avatar_url', check_string)('events[0]', events[0])
|
||||||
|
self.assert_on_error(error)
|
||||||
|
|
||||||
def test_rename_stream(self):
|
def test_rename_stream(self):
|
||||||
realm = get_realm('zulip.com')
|
realm = get_realm('zulip.com')
|
||||||
stream, _ = create_stream_if_needed(realm, 'old_name')
|
stream, _ = create_stream_if_needed(realm, 'old_name')
|
||||||
|
|||||||
Reference in New Issue
Block a user