Skip to content
This repository has been archived by the owner on Sep 11, 2024. It is now read-only.

Commit

Permalink
Merge pull request #2806 from matrix-org/t3chguy/explicit_room_name_s…
Browse files Browse the repository at this point in the history
…ettings

Don't show calculated room name in room settings name input field
  • Loading branch information
turt2live authored Mar 19, 2019
2 parents 6f89c77 + cadf36e commit 6a7e4ba
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/components/views/room_settings/RoomProfileSettings.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit 6a7e4ba

Please sign in to comment.