Merge pull request #316 from matrix-org/rav/fix_react_version_number

UserSettings: fix the displayed version of the react-sdk
This commit is contained in:
David Baker 2016-06-17 17:13:35 +01:00 committed by GitHub
commit 8103a795ec

View file

@ -20,7 +20,7 @@ var MatrixClientPeg = require("../../MatrixClientPeg");
var Modal = require('../../Modal'); var Modal = require('../../Modal');
var dis = require("../../dispatcher"); var dis = require("../../dispatcher");
var q = require('q'); var q = require('q');
var version = require('../../../package.json').version; var package_json = require('../../../package.json');
var UserSettingsStore = require('../../UserSettingsStore'); var UserSettingsStore = require('../../UserSettingsStore');
var GeminiScrollbar = require('react-gemini-scrollbar'); var GeminiScrollbar = require('react-gemini-scrollbar');
var Email = require('../../email'); var Email = require('../../email');
@ -37,6 +37,11 @@ const LABS_FEATURES = [
} }
]; ];
// if this looks like a release, use the 'version' from package.json; else use
// the git sha.
const REACT_SDK_VERSION =
'dist' in package_json ? package_json.version : package_json.gitHead || "<local>";
module.exports = React.createClass({ module.exports = React.createClass({
displayName: 'UserSettings', displayName: 'UserSettings',
@ -57,7 +62,6 @@ module.exports = React.createClass({
return { return {
avatarUrl: null, avatarUrl: null,
threePids: [], threePids: [],
clientVersion: version,
phase: "UserSettings.LOADING", // LOADING, DISPLAY phase: "UserSettings.LOADING", // LOADING, DISPLAY
email_add_pending: false, email_add_pending: false,
}; };
@ -465,7 +469,7 @@ module.exports = React.createClass({
Identity Server is { MatrixClientPeg.get().getIdentityServerUrl() } Identity Server is { MatrixClientPeg.get().getIdentityServerUrl() }
</div> </div>
<div className="mx_UserSettings_advanced"> <div className="mx_UserSettings_advanced">
matrix-react-sdk version: {this.state.clientVersion}<br/> matrix-react-sdk version: {REACT_SDK_VERSION}<br/>
vector-web version: {this.props.version}<br/> vector-web version: {this.props.version}<br/>
</div> </div>
</div> </div>