chat: Omit undefined `authorId`, `displayName` in JSON obj
parent
ad45359a9d
commit
248c114547
|
@ -88,13 +88,10 @@ class ChatMessage {
|
||||||
// TODO: Delete this method once users are unlikely to roll back to a version of Etherpad that
|
// TODO: Delete this method once users are unlikely to roll back to a version of Etherpad that
|
||||||
// doesn't support authorId and displayName.
|
// doesn't support authorId and displayName.
|
||||||
toJSON() {
|
toJSON() {
|
||||||
return {
|
const {authorId, displayName, ...obj} = this;
|
||||||
...this,
|
obj.userId = authorId;
|
||||||
authorId: undefined,
|
obj.userName = displayName;
|
||||||
displayName: undefined,
|
return obj;
|
||||||
userId: this.authorId,
|
|
||||||
userName: this.displayName,
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue