Merge pull request #2577 from vector-im/dbkr/fix_update_bar_version_format

Fix changelog dialog to  read new version format
This commit is contained in:
Richard van der Hoff 2016-11-14 14:15:14 +00:00 committed by GitHub
commit 363453fd06
2 changed files with 5 additions and 4 deletions

View File

@ -31,9 +31,10 @@ export default class ChangelogDialog extends React.Component {
const version = this.props.newVersion.split('-'); const version = this.props.newVersion.split('-');
const version2 = this.props.version.split('-'); const version2 = this.props.version.split('-');
if(version == null || version2 == null) return; if(version == null || version2 == null) return;
// parse versions of form: [vectorversion]-react-[react-sdk-version]-js-[js-sdk-version]
for(let i=0; i<REPOS.length; i++) { for(let i=0; i<REPOS.length; i++) {
const oldVersion = version2[2*i+1]; const oldVersion = version2[2*i];
const newVersion = version[2*i+1]; const newVersion = version[2*i];
request(`https://api.github.com/repos/${REPOS[i]}/compare/${oldVersion}...${newVersion}`, (a, b, body) => { request(`https://api.github.com/repos/${REPOS[i]}/compare/${oldVersion}...${newVersion}`, (a, b, body) => {
if(body == null) return; if(body == null) return;
this.setState({[REPOS[i]]: JSON.parse(body).commits}); this.setState({[REPOS[i]]: JSON.parse(body).commits});

View File

@ -23,11 +23,11 @@ import PlatformPeg from 'matrix-react-sdk/lib/PlatformPeg';
/** /**
* Check a version string is compatible with the Changelog * Check a version string is compatible with the Changelog
* dialog * dialog ([vectorversion]-react-[react-sdk-version]-js-[js-sdk-version])
*/ */
function checkVersion(ver) { function checkVersion(ver) {
const parts = ver.split('-'); const parts = ver.split('-');
return parts[0] == 'vector' && parts[2] == 'react' && parts[4] == 'js'; return parts.length == 5 && parts[1] == 'react' && parts[3] == 'js';
} }
export default React.createClass({ export default React.createClass({