From 5011d3b15816351e77cea098581a0a251c07cd3b Mon Sep 17 00:00:00 2001 From: David Baker Date: Tue, 20 Sep 2016 14:33:25 +0100 Subject: [PATCH] Only show version bar if on develop Or rather, if the version string is in the right format it to work. --- src/components/views/globals/NewVersionBar.js | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/src/components/views/globals/NewVersionBar.js b/src/components/views/globals/NewVersionBar.js index 1aa7d55b..90b30f72 100644 --- a/src/components/views/globals/NewVersionBar.js +++ b/src/components/views/globals/NewVersionBar.js @@ -20,6 +20,15 @@ var React = require('react'); var sdk = require('matrix-react-sdk'); import Modal from 'matrix-react-sdk/lib/Modal'; +/** + * Check a version string is compatible with the Changelog + * dialog + */ +function checkVersion(ver) { + const parts = ver.split('-'); + return parts[0] == 'vector' && parts[2] == 'react' && parts[4] == 'js'; +} + export default function NewVersionBar(props) { const onChangelogClicked = () => { const ChangelogDialog = sdk.getComponent('dialogs.ChangelogDialog'); @@ -35,13 +44,17 @@ export default function NewVersionBar(props) { }); }; + let changelog_button; + if (checkVersion(props.version) && checkVersion(props.newVersion)) { + changelog_button = ; + } return (
/!\
A new version of Riot is available. Refresh your browser.
- + {changelog_button}
); }