File tree Expand file tree Collapse file tree
src/components/views/globals Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -20,6 +20,15 @@ var React = require('react');
2020var sdk = require ( 'matrix-react-sdk' ) ;
2121import 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+
2332export 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}
You can’t perform that action at this time.
0 commit comments