Refactor json_set_avatar and patch_bot_backend to use do_change_avatar_source

(imported from commit eba0ff8a5c4409ac01c710455fe200b28f953b56)
This commit is contained in:
Jason Michalski
2014-02-26 14:54:59 -05:00
parent c0d104c110
commit 280575aff0
2 changed files with 13 additions and 5 deletions

View File

@@ -1340,6 +1340,15 @@ def do_regenerate_api_key(user_profile, log=True):
api_key=user_profile.api_key,)),
bot_owner_userids(user_profile))
def do_change_avatar_source(user_profile, avatar_source, log=True):
user_profile.avatar_source = avatar_source
user_profile.save(update_fields=["avatar_source"])
if log:
log_event({'type': 'user_change_avatar_source',
'user': user_profile.email,
'avatar_source': avatar_source})
def _default_stream_permision_check(user_profile, stream):
# Any user can have a None default stream
if stream is not None: