Fix parsing issue in event tile preview for appearance tab

Fixes https://github.com/vector-im/element-web/issues/15419
This commit is contained in:
Travis Ralston 2020-10-08 14:21:39 -06:00
parent 177b76d882
commit d5b264b7a0

View file

@ -80,27 +80,28 @@ export default class EventTilePreview extends React.Component<IProps, IState> {
private fakeEvent({userId, displayname, avatar_url: avatarUrl}: IState) { private fakeEvent({userId, displayname, avatar_url: avatarUrl}: IState) {
// Fake it till we make it // Fake it till we make it
const event = new MatrixEvent(JSON.parse(`{ const rawEvent = {
"type": "m.room.message", type: "m.room.message",
"sender": "${userId}", sender: userId,
"content": { content: {
"m.new_content": { "m.new_content": {
"msgtype": "m.text", msgtype: "m.text",
"body": "${this.props.message}", body: this.props.message,
"displayname": "${displayname}", displayname: displayname,
"avatar_url": "${avatarUrl}" avatar_url: avatarUrl,
}, },
"msgtype": "m.text", msgtype: "m.text",
"body": "${this.props.message}", body: this.props.message,
"displayname": "${displayname}", displayname: displayname,
"avatar_url": "${avatarUrl}" avatar_url: avatarUrl,
}, },
"unsigned": { unsigned: {
"age": 97 age: 97,
}, },
"event_id": "$9999999999999999999999999999999999999999999", event_id: "$9999999999999999999999999999999999999999999",
"room_id": "!999999999999999999:matrix.org" room_id: "!999999999999999999:example.org",
}`)); };
const event = new MatrixEvent(rawEvent);
// Fake it more // Fake it more
event.sender = { event.sender = {