Skip to content

Commit 5011d3b

Browse files
committed
Only show version bar if on develop
Or rather, if the version string is in the right format it to work.
1 parent c10b11a commit 5011d3b

1 file changed

Lines changed: 14 additions & 1 deletion

File tree

‎src/components/views/globals/NewVersionBar.js‎

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,15 @@ var React = require('react');
2020
var sdk = require('matrix-react-sdk');
2121
import Modal from 'matrix-react-sdk/lib/Modal';
2222

23+
/**
24+
* Check a version string is compatible with the Changelog
25+
* dialog
26+
*/
27+
function checkVersion(ver) {
28+
const parts = ver.split('-');
29+
return parts[0] == 'vector' && parts[2] == 'react' && parts[4] == 'js';
30+
}
31+
2332
export default function NewVersionBar(props) {
2433
const onChangelogClicked = () => {
2534
const ChangelogDialog = sdk.getComponent('dialogs.ChangelogDialog');
@@ -35,13 +44,17 @@ export default function NewVersionBar(props) {
3544
});
3645
};
3746

47+
let changelog_button;
48+
if (checkVersion(props.version) && checkVersion(props.newVersion)) {
49+
changelog_button = <button className="mx_MatrixToolbar_action" onClick={onChangelogClicked}>Changelog</button>;
50+
}
3851
return (
3952
<div className="mx_MatrixToolbar">
4053
<img className="mx_MatrixToolbar_warning" src="img/warning.svg" width="24" height="23" alt="/!\"/>
4154
<div className="mx_MatrixToolbar_content">
4255
A new version of Riot is available. Refresh your browser.
4356
</div>
44-
<button className="mx_MatrixToolbar_action" onClick={onChangelogClicked}>Changelog</button>
57+
{changelog_button}
4558
</div>
4659
);
4760
}

0 commit comments

Comments
 (0)