Merge pull request #532 from matrix-org/dbkr/platform_version

Move 'new version' support into Platform
This commit is contained in:
David Baker 2016-11-03 13:30:30 +00:00 committed by GitHub
commit 31a47a9efd

View file

@ -105,6 +105,8 @@ module.exports = React.createClass({
version: null, version: null,
newVersion: null, newVersion: null,
hasNewVersion: false,
newVersionReleaseNotes: null,
// The username to default to when upgrading an account from a guest // The username to default to when upgrading an account from a guest
upgradeUsername: null, upgradeUsername: null,
@ -469,6 +471,12 @@ module.exports = React.createClass({
case 'load_completed': case 'load_completed':
this._onLoadCompleted(); this._onLoadCompleted();
break; break;
case 'new_version':
this.onVersion(
payload.currentVersion, payload.newVersion,
payload.releaseNotes
);
break;
} }
}, },
@ -961,11 +969,12 @@ module.exports = React.createClass({
this.showScreen("settings"); this.showScreen("settings");
}, },
onVersion: function(current, latest) { onVersion: function(current, latest, releaseNotes) {
this.setState({ this.setState({
version: current, version: current,
newVersion: latest, newVersion: latest,
hasNewVersion: current !== latest hasNewVersion: current !== latest,
newVersionReleaseNotes: releaseNotes,
}); });
}, },
@ -1100,7 +1109,9 @@ module.exports = React.createClass({
var topBar; var topBar;
if (this.state.hasNewVersion) { if (this.state.hasNewVersion) {
topBar = <NewVersionBar version={this.state.version} newVersion={this.state.newVersion} />; topBar = <NewVersionBar version={this.state.version} newVersion={this.state.newVersion}
releaseNotes={this.state.newVersionReleaseNotes}
/>;
} }
else if (MatrixClientPeg.get().isGuest()) { else if (MatrixClientPeg.get().isGuest()) {
topBar = <GuestWarningBar />; topBar = <GuestWarningBar />;