mirror of
https://github.com/element-hq/element-web
synced 2024-11-24 02:05:45 +03:00
Add room name to component state
Signed-off-by: Paulo Pinto <paulo.pinto@automattic.com>
This commit is contained in:
parent
1b334e47aa
commit
ea55b0d45f
1 changed files with 18 additions and 2 deletions
|
@ -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() {
|
||||
|
@ -66,6 +76,12 @@ export default class RoomSettingsDialog extends React.Component<IProps> {
|
|||
}
|
||||
};
|
||||
|
||||
private setRoomName = (): void => {
|
||||
this.setState({
|
||||
roomName: MatrixClientPeg.get().getRoom(this.props.roomId).name,
|
||||
});
|
||||
};
|
||||
|
||||
private getTabs(): Tab[] {
|
||||
const tabs: Tab[] = [];
|
||||
|
||||
|
@ -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'
|
||||
|
|
Loading…
Reference in a new issue