diff --git a/functions/src/change-user-info.ts b/functions/src/change-user-info.ts index f85d45b3..78da65e3 100644 --- a/functions/src/change-user-info.ts +++ b/functions/src/change-user-info.ts @@ -5,7 +5,7 @@ import { getUser } from './utils' import { Contract } from 'common/contract' import { Comment } from 'common/comment' import { User } from 'common/user' -import { cleanUsername } from 'common/util/clean-username' +import { cleanUsername, cleanDisplayName } from 'common/util/clean-username' import { removeUndefinedProps } from 'common/util/object' import { Answer } from 'common/answer' @@ -63,6 +63,10 @@ export const changeUser = async ( } } + if (update.name) { + update.name = cleanDisplayName(update.name); + } + const userRef = firestore.collection('users').doc(user.id) const userUpdate: Partial = removeUndefinedProps(update)