Merge pull request #5332 from Transfusion/trim_display_name
Trim spurious whitespace of nicknames
This commit is contained in:
commit
c73ad9e594
2 changed files with 8 additions and 5 deletions
|
@ -100,10 +100,11 @@ export default class RoomProfileSettings extends React.Component {
|
||||||
const newState = {};
|
const newState = {};
|
||||||
|
|
||||||
// TODO: What do we do about errors?
|
// TODO: What do we do about errors?
|
||||||
|
const displayName = this.state.displayName.trim();
|
||||||
if (this.state.originalDisplayName !== this.state.displayName) {
|
if (this.state.originalDisplayName !== this.state.displayName) {
|
||||||
await client.setRoomName(this.props.roomId, this.state.displayName);
|
await client.setRoomName(this.props.roomId, displayName);
|
||||||
newState.originalDisplayName = this.state.displayName;
|
newState.originalDisplayName = displayName;
|
||||||
|
newState.displayName = displayName;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.state.avatarFile) {
|
if (this.state.avatarFile) {
|
||||||
|
|
|
@ -81,10 +81,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) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue