Skip to content
This repository has been archived by the owner on Nov 27, 2023. It is now read-only.

refactor: simplified pull request status #186

Merged
merged 1 commit into from
Sep 21, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 1 addition & 4 deletions src/status-bar-manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -130,10 +130,7 @@ export class StatusBarManager {
if (typeof pullRequest.mergeable === 'undefined') {
status = 'failure';
} else {
const combinedStatus = await this.githubManager.getCombinedStatusForPullRequest();
if (combinedStatus) {
status = combinedStatus;
} else if (pullRequest.mergeable) {
if (pullRequest.mergeable) {
status = 'success';
} else {
status = 'failure';
Expand Down
11 changes: 0 additions & 11 deletions src/workflow-manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import {
GitHub,
GitHubError,
PullRequestStruct,
PullRequestStatus,
Issue,
PullRequestComment
} from './provider/github';
Expand Down Expand Up @@ -110,16 +109,6 @@ export class WorkflowManager {
return Boolean(await this.getPullRequestForCurrentBranch());
}

public async getCombinedStatusForPullRequest(): Promise<PullRequestStatus |undefined> {
const [owner, repository] = await git.getGitHubOwnerAndRepository(this.cwd);
const branch = await git.getCurrentBranch(this.cwd);
if (!branch) {
return undefined;
}
const response = await this.github.getStatusForRef(owner, repository, branch);
return response.body.total_count > 0 ? response.body.state : undefined;
}

public async createPullRequest(upstream?: {owner: string, repository: string, branch: string}):
Promise<PullRequest|undefined> {
if (await this.hasPullRequestForCurrentBranch()) {
Expand Down