Skip to content

Commit

Permalink
fix(issue): Fix wrong repository was used (#659)
Browse files Browse the repository at this point in the history
  • Loading branch information
chinesedfan authored and Houssein Djirdeh committed Dec 10, 2017
1 parent 4609e1f commit e2b7fda
Showing 1 changed file with 22 additions and 17 deletions.
39 changes: 22 additions & 17 deletions src/issue/screens/issue.screen.js
Original file line number Diff line number Diff line change
Expand Up @@ -199,28 +199,33 @@ class Issue extends Component {
.replace(`${v3.root}/repos/`, '')
.replace(/([^/]+\/[^/]+)\/issues\/\d+$/, '$1');

const repoName = repository.name;
const owner = repository.owner.login;

Promise.all([
getIssueFromUrl(issueURL),
getIssueComments(`${issueURL}/comments`),
]).then(() => {
const issue = this.props.issue;

if (repository.full_name !== issueRepository) {
Promise.all([
getRepository(issue.repository_url),
getContributors(this.getContributorsLink(issue.repository_url)),
]).then(() => {
this.setNavigationParams();
});
} else {
])
.then(() => {
const issue = this.props.issue;

if (repository.full_name !== issueRepository) {
return Promise.all([
getRepository(issue.repository_url),
getContributors(this.getContributorsLink(issue.repository_url)),
]);
}

return [];
})
.then(() => {
const { issue, repository } = this.props;

this.setNavigationParams();
}

return getIssueEvents(owner, repoName, issue.number);
});
return getIssueEvents(
repository.owner.login,
repository.name,
issue.number
);
});
};

getContributorsLink = repository => `${repository}/contributors`;
Expand Down

0 comments on commit e2b7fda

Please sign in to comment.