Fixed webhook so that users' full_name isn't reset to the empty string.

This commit is contained in:
2017-12-08 14:04:11 +01:00
parent 1ae090789b
commit f948969b20
2 changed files with 29 additions and 2 deletions

View File

@@ -78,9 +78,13 @@ def user_modified():
updates['email'] = payload['email']
if payload['full_name'] != db_user['full_name']:
my_log.info('User changed full name from %s to %s',
my_log.info('User changed full name from %r to %r',
payload['full_name'], db_user['full_name'])
updates['full_name'] = payload['full_name']
if payload['full_name']:
updates['full_name'] = payload['full_name']
else:
# Fall back to the username when the full name was erased.
updates['full_name'] = db_user['username']
if updates:
update_res = users_coll.update_one({'_id': db_user['_id']},