mirror of
https://github.com/SchildiChat/element-web.git
synced 2024-10-01 01:26:12 -04:00
remove whatwg-fetch and use browser-request
This commit is contained in:
parent
be28a96d8d
commit
56813eb11e
@ -58,8 +58,7 @@
|
|||||||
"react-gemini-scrollbar": "matrix-org/react-gemini-scrollbar#5e97aef",
|
"react-gemini-scrollbar": "matrix-org/react-gemini-scrollbar#5e97aef",
|
||||||
"sanitize-html": "^1.11.1",
|
"sanitize-html": "^1.11.1",
|
||||||
"ua-parser-js": "^0.7.10",
|
"ua-parser-js": "^0.7.10",
|
||||||
"url": "^0.11.0",
|
"url": "^0.11.0"
|
||||||
"whatwg-fetch": "^1.0.0"
|
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"babel": "^5.8.23",
|
"babel": "^5.8.23",
|
||||||
|
@ -17,6 +17,7 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import sdk from 'matrix-react-sdk';
|
import sdk from 'matrix-react-sdk';
|
||||||
import 'whatwg-fetch';
|
import 'whatwg-fetch';
|
||||||
|
import request from 'browser-request';
|
||||||
|
|
||||||
const REPOS = ['vector-im/vector-web', 'matrix-org/matrix-react-sdk', 'matrix-org/matrix-js-sdk'];
|
const REPOS = ['vector-im/vector-web', 'matrix-org/matrix-react-sdk', 'matrix-org/matrix-js-sdk'];
|
||||||
|
|
||||||
@ -28,17 +29,16 @@ export default class ChangelogDialog extends React.Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
componentDidMount() {
|
componentDidMount() {
|
||||||
console.log(this.props);
|
const version = this.props.newVersion.split('-');
|
||||||
const version = this.props.newVersion;
|
const version2 = this.props.version.split('-');
|
||||||
const version2 = this.props.version;
|
|
||||||
if(version == null || version2 == null) return;
|
if(version == null || version2 == null) return;
|
||||||
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+1];
|
||||||
const newVersion = version[2*i+1];
|
const newVersion = version[2*i+1];
|
||||||
fetch(`https://api.github.com/repos/${REPOS[i]}/compare/${oldVersion}...${newVersion}`)
|
request(`https://api.github.com/repos/${REPOS[i]}/compare/${oldVersion}...${newVersion}`, (a, b, body) => {
|
||||||
.then(response => response.json())
|
if(body == null) return;
|
||||||
.then(json => this.setState({[REPOS[i]]: json.commits}));
|
this.setState({[REPOS[i]]: JSON.parse(body).commits});
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -23,7 +23,7 @@ import Modal from 'matrix-react-sdk/lib/Modal';
|
|||||||
export default function NewVersionBar(props) {
|
export default function NewVersionBar(props) {
|
||||||
const onChangelogClicked = () => {
|
const onChangelogClicked = () => {
|
||||||
const ChangelogDialog = sdk.getComponent('dialogs.ChangelogDialog');
|
const ChangelogDialog = sdk.getComponent('dialogs.ChangelogDialog');
|
||||||
console.log(props);
|
|
||||||
Modal.createDialog(ChangelogDialog, {
|
Modal.createDialog(ChangelogDialog, {
|
||||||
version: props.version,
|
version: props.version,
|
||||||
newVersion: props.newVersion,
|
newVersion: props.newVersion,
|
||||||
@ -38,10 +38,10 @@ export default function NewVersionBar(props) {
|
|||||||
return (
|
return (
|
||||||
<div className="mx_MatrixToolbar">
|
<div className="mx_MatrixToolbar">
|
||||||
<img className="mx_MatrixToolbar_warning" src="img/warning.svg" width="24" height="23" alt="/!\"/>
|
<img className="mx_MatrixToolbar_warning" src="img/warning.svg" width="24" height="23" alt="/!\"/>
|
||||||
<div style={{flex: 1}}>
|
<div className="mx_MatrixToolbar_content">
|
||||||
A new version of Vector is available. Refresh your browser.
|
A new version of Vector is available. Refresh your browser.
|
||||||
</div>
|
</div>
|
||||||
<button style={{marginRight: 16}} onClick={onChangelogClicked}>Changelog</button>
|
<button className="mx_MatrixToolbar_action" onClick={onChangelogClicked}>Changelog</button>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -54,3 +54,7 @@ limitations under the License.
|
|||||||
float: right;
|
float: right;
|
||||||
margin-right: 10px;
|
margin-right: 10px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.mx_MatrixToolbar_action {
|
||||||
|
margin-right: 16px;
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user