Skip to content

Commit

Permalink
Fixed syntax
Browse files Browse the repository at this point in the history
  • Loading branch information
OscarBarrett committed Aug 23, 2022
1 parent b37c807 commit d015c09
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 18 deletions.
20 changes: 11 additions & 9 deletions source/platforms/bitbucket_cloud/BitBucketCloudAPI.ts
Expand Up @@ -219,20 +219,22 @@ export class BitBucketCloudAPI {
const dangerIDMessage = dangerIDToString(dangerID)

return comments
.filter(comment => comment.inline == null)
.filter(comment => comment.content.raw.includes(dangerIDMessage))
.filter(comment => comment.user.uuid === this.uuid)
.filter((comment) => comment.inline == null)
.filter((comment) => comment.content.raw.includes(dangerIDMessage))
.filter((comment) => comment.user.uuid === this.uuid)
}

getDangerInlineComments = async (dangerID: string): Promise<Comment[]> => {
const comments = await this.getPullRequestComments()
const dangerIDMessage = dangerIDToString(dangerID)

return comments.filter(comment => comment.inline).map(comment => ({
id: comment.id.toString(),
ownedByDanger: comment.content.raw.includes(dangerIDMessage) && comment.user.uuid === this.uuid,
body: comment.content.raw,
}))
return comments
.filter((comment) => comment.inline)
.map((comment) => ({
id: comment.id.toString(),
ownedByDanger: comment.content.raw.includes(dangerIDMessage) && comment.user.uuid === this.uuid,
body: comment.content.raw,
}))
}

postBuildStatus = async (
Expand Down Expand Up @@ -370,7 +372,7 @@ export class BitBucketCloudAPI {
let agent: Agent | undefined = undefined
let proxy = process.env.http_proxy || process.env.https_proxy
if (proxy) {
agent = new HttpsProxyAgent(proxy)
agent = HttpsProxyAgent(proxy)
}

return this.fetch(
Expand Down
19 changes: 10 additions & 9 deletions source/platforms/bitbucket_server/BitBucketServerAPI.ts
Expand Up @@ -209,12 +209,12 @@ export class BitBucketServerAPI implements BitBucketServerAPIDSL {
const activities = await this.getPullRequestComments()
const dangerIDMessage = dangerIDToString(dangerID)

const comments = activities.map(activity => activity.comment).filter(Boolean) as BitBucketServerPRComment[]
const comments = activities.map((activity) => activity.comment).filter(Boolean) as BitBucketServerPRComment[]

return comments
.filter(comment => comment!.text.includes(dangerIDMessage))
.filter(comment => comment!.author.name.toLowerCase() === username!.toLowerCase())
.filter(comment => comment!.text.includes("Generated by"))
.filter((comment) => comment!.text.includes(dangerIDMessage))
.filter((comment) => comment!.author.name.toLowerCase() === username!.toLowerCase())
.filter((comment) => comment!.text.includes("Generated by"))
}

getDangerInlineComments = async (dangerID: string): Promise<Comment[]> => {
Expand All @@ -223,16 +223,17 @@ export class BitBucketServerAPI implements BitBucketServerAPIDSL {
const dangerIDMessage = dangerIDToString(dangerID)

const comments = activities
.filter(activity => activity.commentAnchor)
.map(activity => activity.comment)
.filter((activity) => activity.commentAnchor)
.map((activity) => activity.comment)
.filter(Boolean) as BitBucketServerPRComment[]
return new Promise<Comment[]>(resolve => {
return new Promise<Comment[]>((resolve) => {
resolve(
comments
.map((i: any) => {
return {
id: i.id,
ownedByDanger: i.author.name.toLowerCase() === username!.toLowerCase() && i.text.includes(dangerIDMessage),
ownedByDanger:
i.author.name.toLowerCase() === username!.toLowerCase() && i.text.includes(dangerIDMessage),
body: i.text,
}
})
Expand Down Expand Up @@ -353,7 +354,7 @@ export class BitBucketServerAPI implements BitBucketServerAPIDSL {
let agent: Agent | undefined = undefined
let proxy = process.env.http_proxy || process.env.https_proxy
if (proxy) {
agent = new HttpsProxyAgent(proxy)
agent = HttpsProxyAgent(proxy)
}

return this.fetch(
Expand Down

0 comments on commit d015c09

Please sign in to comment.