Trim spurious whitespace of nicknames

This commit is contained in:
Bryan Kok 2020-10-17 23:52:18 +08:00
parent d5e9d5306a
commit 7d22bbc00f

View file

@ -77,10 +77,12 @@ export default class ProfileSettings extends React.Component {
const client = MatrixClientPeg.get(); const client = MatrixClientPeg.get();
const newState = {}; const newState = {};
const displayName = this.state.displayName.trim();
try { try {
if (this.state.originalDisplayName !== this.state.displayName) { if (this.state.originalDisplayName !== this.state.displayName) {
await client.setDisplayName(this.state.displayName); await client.setDisplayName(displayName);
newState.originalDisplayName = this.state.displayName; newState.originalDisplayName = displayName;
newState.displayName = displayName;
} }
if (this.state.avatarFile) { if (this.state.avatarFile) {