mirror of
https://github.com/SchildiChat/element-web.git
synced 2024-10-01 01:26:12 -04:00
Merge remote-tracking branch 'origin/develop' into dbkr/electron_3
This commit is contained in:
commit
fb3ca441ba
@ -16,8 +16,8 @@ limitations under the License.
|
|||||||
|
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
var React = require('react');
|
import React from 'react';
|
||||||
var sdk = require('matrix-react-sdk');
|
import sdk from 'matrix-react-sdk';
|
||||||
import Modal from 'matrix-react-sdk/lib/Modal';
|
import Modal from 'matrix-react-sdk/lib/Modal';
|
||||||
import PlatformPeg from 'matrix-react-sdk/lib/PlatformPeg';
|
import PlatformPeg from 'matrix-react-sdk/lib/PlatformPeg';
|
||||||
|
|
||||||
@ -30,13 +30,18 @@ function checkVersion(ver) {
|
|||||||
return parts[0] == 'vector' && parts[2] == 'react' && parts[4] == 'js';
|
return parts[0] == 'vector' && parts[2] == 'react' && parts[4] == 'js';
|
||||||
}
|
}
|
||||||
|
|
||||||
export default function NewVersionBar(props) {
|
export default React.createClass({
|
||||||
const onChangelogClicked = () => {
|
propTypes: {
|
||||||
if (props.releaseNotes) {
|
version: React.PropTypes.string.isRequired,
|
||||||
|
newVersion: React.PropTypes.string.isRequired,
|
||||||
|
releaseNotes: React.PropTypes.string,
|
||||||
|
},
|
||||||
|
|
||||||
|
displayReleaseNotes: function(releaseNotes) {
|
||||||
const QuestionDialog = sdk.getComponent('dialogs.QuestionDialog');
|
const QuestionDialog = sdk.getComponent('dialogs.QuestionDialog');
|
||||||
Modal.createDialog(QuestionDialog, {
|
Modal.createDialog(QuestionDialog, {
|
||||||
title: "What's New",
|
title: "What's New",
|
||||||
description: <pre className="changelog_text">{props.releaseNotes}</pre>,
|
description: <pre className="changelog_text">{releaseNotes}</pre>,
|
||||||
button: "Update",
|
button: "Update",
|
||||||
onFinished: (update) => {
|
onFinished: (update) => {
|
||||||
if(update && PlatformPeg.get()) {
|
if(update && PlatformPeg.get()) {
|
||||||
@ -44,30 +49,37 @@ export default function NewVersionBar(props) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
} else {
|
},
|
||||||
|
|
||||||
|
displayChangelog: function() {
|
||||||
const ChangelogDialog = sdk.getComponent('dialogs.ChangelogDialog');
|
const ChangelogDialog = sdk.getComponent('dialogs.ChangelogDialog');
|
||||||
Modal.createDialog(ChangelogDialog, {
|
Modal.createDialog(ChangelogDialog, {
|
||||||
version: props.version,
|
version: this.props.version,
|
||||||
newVersion: props.newVersion,
|
newVersion: this.props.newVersion,
|
||||||
releaseNotes: releaseNotes,
|
|
||||||
onFinished: (update) => {
|
onFinished: (update) => {
|
||||||
if(update && PlatformPeg.get()) {
|
if(update && PlatformPeg.get()) {
|
||||||
PlatformPeg.get().installUpdate();
|
PlatformPeg.get().installUpdate();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
},
|
||||||
};
|
|
||||||
|
|
||||||
const onUpdateClicked = () => {
|
onUpdateClicked: function() {
|
||||||
PlatformPeg.get().installUpdate();
|
PlatformPeg.get().installUpdate();
|
||||||
};
|
},
|
||||||
|
|
||||||
|
render: function() {
|
||||||
let action_button;
|
let action_button;
|
||||||
if (props.releaseNotes || (checkVersion(props.version) && checkVersion(props.newVersion))) {
|
// If we have release notes to display, we display them. Otherwise,
|
||||||
action_button = <button className="mx_MatrixToolbar_action" onClick={onChangelogClicked}>What's new?</button>;
|
// we display the Changelog Dialog which takes two versions and
|
||||||
|
// automatically tells you what's changed (provided the versions
|
||||||
|
// are in the right format)
|
||||||
|
if (this.props.releaseNotes) {
|
||||||
|
action_button = <button className="mx_MatrixToolbar_action" onClick={this.displayReleaseNotes}>What's new?</button>;
|
||||||
|
} else if (checkVersion(this.props.version) && checkVersion(this.props.newVersion)) {
|
||||||
|
action_button = <button className="mx_MatrixToolbar_action" onClick={this.displayChangelog}>What's new?</button>;
|
||||||
} else if (PlatformPeg.get()) {
|
} else if (PlatformPeg.get()) {
|
||||||
action_button = <button className="mx_MatrixToolbar_action" onClick={onUpdateClicked}>Update</button>;
|
action_button = <button className="mx_MatrixToolbar_action" onClick={this.onUpdateClicked}>Update</button>;
|
||||||
}
|
}
|
||||||
return (
|
return (
|
||||||
<div className="mx_MatrixToolbar">
|
<div className="mx_MatrixToolbar">
|
||||||
@ -79,9 +91,4 @@ export default function NewVersionBar(props) {
|
|||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
});
|
||||||
NewVersionBar.propTypes = {
|
|
||||||
version: React.PropTypes.string.isRequired,
|
|
||||||
newVersion: React.PropTypes.string.isRequired,
|
|
||||||
releaseNotes: React.PropTypes.string,
|
|
||||||
};
|
|
||||||
|
@ -1,7 +1,8 @@
|
|||||||
// @flow
|
// @flow
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Copyright 2016 Aviral Dasgupta and OpenMarket Ltd
|
Copyright 2016 Aviral Dasgupta
|
||||||
|
Copyright 2016 OpenMarket Ltd
|
||||||
|
|
||||||
Licensed under the Apache License, Version 2.0 (the "License");
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
you may not use this file except in compliance with the License.
|
you may not use this file except in compliance with the License.
|
||||||
|
@ -1,7 +1,8 @@
|
|||||||
// @flow
|
// @flow
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Copyright 2016 Aviral Dasgupta and OpenMarket Ltd
|
Copyright 2016 Aviral Dasgupta
|
||||||
|
Copyright 2016 OpenMarket Ltd
|
||||||
|
|
||||||
Licensed under the Apache License, Version 2.0 (the "License");
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
you may not use this file except in compliance with the License.
|
you may not use this file except in compliance with the License.
|
||||||
|
@ -1,7 +1,8 @@
|
|||||||
// @flow
|
// @flow
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Copyright 2016 Aviral Dasgupta and OpenMarket Ltd
|
Copyright 2016 Aviral Dasgupta
|
||||||
|
Copyright 2016 OpenMarket Ltd
|
||||||
|
|
||||||
Licensed under the Apache License, Version 2.0 (the "License");
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
you may not use this file except in compliance with the License.
|
you may not use this file except in compliance with the License.
|
||||||
|
Loading…
Reference in New Issue
Block a user