Fix room upgrade warnings popping up in upgraded rooms
Rooms which are already upgraded shouldn't be asked to upgrade. Additionally, this fixes a bug where the room upgrade dialog would stay open even after upgrading the room.
This commit is contained in:
parent
054011f5f8
commit
4beecb50c9
4 changed files with 62 additions and 20 deletions
|
@ -38,8 +38,13 @@ export default class AdvancedRoomSettingsTab extends React.Component {
|
|||
|
||||
componentWillMount() {
|
||||
// we handle lack of this object gracefully later, so don't worry about it failing here.
|
||||
MatrixClientPeg.get().getRoom(this.props.roomId).getRecommendedVersion().then((v) => {
|
||||
this.setState({upgradeRecommendation: v});
|
||||
const room = MatrixClientPeg.get().getRoom(this.props.roomId);
|
||||
room.getRecommendedVersion().then((v) => {
|
||||
const tombstone = room.currentState.getStateEvents("m.room.tombstone", "");
|
||||
this.setState({
|
||||
upgraded: tombstone && tombstone.getContent().replacement_room,
|
||||
upgradeRecommendation: v,
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -65,7 +70,7 @@ export default class AdvancedRoomSettingsTab extends React.Component {
|
|||
}
|
||||
|
||||
let roomUpgradeButton;
|
||||
if (this.state.upgradeRecommendation && this.state.upgradeRecommendation.needsUpgrade) {
|
||||
if (this.state.upgradeRecommendation && this.state.upgradeRecommendation.needsUpgrade && !this.state.upgraded) {
|
||||
roomUpgradeButton = (
|
||||
<div>
|
||||
<p className='mx_SettingsTab_warningText'>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue