From cadf36e1c9dede95a23af433206edc03b2d8cc54 Mon Sep 17 00:00:00 2001 From: Michael Telatynski <7t3chguy@gmail.com> Date: Mon, 18 Mar 2019 23:33:24 +0000 Subject: [PATCH] Don't show calculated room name in room settings name input field Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> --- .../views/room_settings/RoomProfileSettings.js | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/components/views/room_settings/RoomProfileSettings.js b/src/components/views/room_settings/RoomProfileSettings.js index 8205ee3f6e..1c36328c00 100644 --- a/src/components/views/room_settings/RoomProfileSettings.js +++ b/src/components/views/room_settings/RoomProfileSettings.js @@ -34,14 +34,20 @@ export default class RoomProfileSettings extends React.Component { const client = MatrixClientPeg.get(); const room = client.getRoom(props.roomId); if (!room) throw new Error("Expected a room for ID: ", props.roomId); + const avatarEvent = room.currentState.getStateEvents("m.room.avatar", ""); let avatarUrl = avatarEvent && avatarEvent.getContent() ? avatarEvent.getContent()["url"] : null; if (avatarUrl) avatarUrl = client.mxcUrlToHttp(avatarUrl, 96, 96, 'crop', false); + const topicEvent = room.currentState.getStateEvents("m.room.topic", ""); const topic = topicEvent && topicEvent.getContent() ? topicEvent.getContent()['topic'] : ''; + + const nameEvent = room.currentState.getStateEvents('m.room.name', ''); + const name = nameEvent && nameEvent.getContent() ? nameEvent.getContent()['name'] : ''; + this.state = { - originalDisplayName: room.name, - displayName: room.name, + originalDisplayName: name, + displayName: name, originalAvatarUrl: avatarUrl, avatarUrl: avatarUrl, avatarFile: null,