Merge remote-tracking branch 'origin/develop' into develop

pull/21833/head
Weblate 2018-12-19 18:10:26 +00:00
commit 6db4e32f19
2 changed files with 18 additions and 6 deletions

View File

@ -36,8 +36,12 @@ export default class ChangelogDialog extends React.Component {
for (let i=0; i<REPOS.length; i++) { for (let i=0; i<REPOS.length; i++) {
const oldVersion = version2[2*i]; const oldVersion = version2[2*i];
const newVersion = version[2*i]; const newVersion = version[2*i];
request(`https://api.github.com/repos/${REPOS[i]}/compare/${oldVersion}...${newVersion}`, (a, b, body) => { const url = `https://api.github.com/repos/${REPOS[i]}/compare/${oldVersion}...${newVersion}`;
if (body == null) return; request(url, (err, response, body) => {
if (response.statusCode < 200 || response.statusCode >= 300) {
this.setState({ [REPOS[i]]: response.statusText });
return;
}
this.setState({[REPOS[i]]: JSON.parse(body).commits}); this.setState({[REPOS[i]]: JSON.parse(body).commits});
}); });
} }
@ -58,13 +62,20 @@ export default class ChangelogDialog extends React.Component {
const QuestionDialog = sdk.getComponent('dialogs.QuestionDialog'); const QuestionDialog = sdk.getComponent('dialogs.QuestionDialog');
const logs = REPOS.map(repo => { const logs = REPOS.map(repo => {
if (this.state[repo] == null) return <Spinner key={repo} />; let content;
if (this.state[repo] == null) {
content = <Spinner key={repo} />;
} else if (typeof this.state[repo] === "string") {
content = _t("Unable to load commit detail: %(msg)s", {
msg: this.state[repo],
});
} else {
content = this.state[repo].map(this._elementsForCommit);
}
return ( return (
<div key={repo}> <div key={repo}>
<h2>{repo}</h2> <h2>{repo}</h2>
<ul> <ul>{content}</ul>
{this.state[repo].map(this._elementsForCommit)}
</ul>
</div> </div>
); );
}); });

View File

@ -889,6 +889,7 @@
"What GitHub issue are these logs for?": "What GitHub issue are these logs for?", "What GitHub issue are these logs for?": "What GitHub issue are these logs for?",
"Notes:": "Notes:", "Notes:": "Notes:",
"Send logs": "Send logs", "Send logs": "Send logs",
"Unable to load commit detail: %(msg)s": "Unable to load commit detail: %(msg)s",
"Unavailable": "Unavailable", "Unavailable": "Unavailable",
"Changelog": "Changelog", "Changelog": "Changelog",
"Create a new chat or reuse an existing one": "Create a new chat or reuse an existing one", "Create a new chat or reuse an existing one": "Create a new chat or reuse an existing one",