Skip to content

Commit

Permalink
fix issue when mergeResult object is missing
Browse files Browse the repository at this point in the history
  • Loading branch information
Serghei Paduret committed Jan 18, 2022
1 parent 6262076 commit 2af9267
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export class PullRequestComponent implements OnInit {

this.needsWork = this.pullRequest.reviewers.some(r => r.status === PullRequestStatus.NeedsWork);
this.approved = !this.needsWork && this.pullRequest.reviewers.some(r => r.status === PullRequestStatus.Approved);
this.hasConflicts = this.pullRequest.properties.mergeResult.outcome === BitbucketMergeResultOutcome.Conflicted;
this.hasConflicts = this.pullRequest.properties.mergeResult?.outcome === BitbucketMergeResultOutcome.Conflicted;

this.status = this.needsWork && 'NEEDS WORK'
|| this.hasConflicts && 'HAS CONFLICTS'
Expand Down
2 changes: 1 addition & 1 deletion src/app/models/models.ts
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ export class BitbucketComment {
}

export class Properties {
mergeResult!: MergeResult;
mergeResult?: MergeResult;
commentCount?: number;
}

Expand Down
4 changes: 2 additions & 2 deletions src/app/services/bitbucket-pr-rules.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,8 @@ export function CommentRule(a: PullRequestActivity, lastDataFetchingTimestamp: n
* pr merge result moved to conflicted state
*/
export function ConflictedRule(before: PullRequest, now: PullRequest) {
return before.properties.mergeResult.outcome !== BitbucketMergeResultOutcome.Conflicted
&& now.properties.mergeResult.outcome === BitbucketMergeResultOutcome.Conflicted;
return before.properties.mergeResult?.outcome !== BitbucketMergeResultOutcome.Conflicted
&& now.properties.mergeResult?.outcome === BitbucketMergeResultOutcome.Conflicted;
}

/**
Expand Down
2 changes: 1 addition & 1 deletion src/manifest.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"manifest_version": 2,
"name": "Pull Request Notifications",
"version": "0.1.13",
"version": "0.1.14",
"description": "Display notifications for Bitbucket pull requests.",
"icons": {
"64": "icon64.png",
Expand Down

0 comments on commit 2af9267

Please sign in to comment.