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

Update room settings dialog title when room name changes #6916

Merged
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 18 additions & 2 deletions src/components/views/dialogs/RoomSettingsDialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,22 @@ interface IProps {
initialTabId?: string;
}

interface IState {
roomName: string;
}

@replaceableComponent("views.dialogs.RoomSettingsDialog")
export default class RoomSettingsDialog extends React.Component<IProps> {
export default class RoomSettingsDialog extends React.Component<IProps, IState> {
private dispatcherRef: string;

constructor(props: IProps) {
super(props);
this.state = { roomName: '' };
}

public componentDidMount() {
this.dispatcherRef = dis.register(this.onAction);
this.setRoomName();
}

public componentWillUnmount() {
Expand All @@ -66,6 +76,12 @@ export default class RoomSettingsDialog extends React.Component<IProps> {
}
};

private setRoomName = (): void => {
psrpinto marked this conversation as resolved.
Show resolved Hide resolved
psrpinto marked this conversation as resolved.
Show resolved Hide resolved
this.setState({
roomName: MatrixClientPeg.get().getRoom(this.props.roomId).name,
});
};

private getTabs(): Tab[] {
const tabs: Tab[] = [];

Expand Down Expand Up @@ -122,7 +138,7 @@ export default class RoomSettingsDialog extends React.Component<IProps> {
}

render() {
const roomName = MatrixClientPeg.get().getRoom(this.props.roomId).name;
const roomName = this.state.roomName;
return (
<BaseDialog
className='mx_RoomSettingsDialog'
Expand Down