Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bitbucket Cloud: Fix bug when Danger updating inline comment with summary comment #1076

Merged
merged 4 commits into from Oct 12, 2020

Conversation

HelloCore
Copy link
Member

When updating summary comment, Danger will call getDangerComments which will get all Danger's comments (including inline comment) for updating.
We need to filter inline comments out, so Danger will only update the main comment.

@HelloCore HelloCore added the bug label Oct 9, 2020
@HelloCore HelloCore requested a review from orta October 9, 2020 10:51
Copy link
Member

@fbartho fbartho left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't use BitBucket myself, so I cannot test this, but it seems pretty straightforward.

I've provided some minor change requests above, but once those are addressed this seems reasonable to me.

CHANGELOG.md Outdated Show resolved Hide resolved
@@ -214,11 +214,12 @@ export class BitBucketCloudAPI {
return await res.text()
}

getDangerComments = async (dangerID: string): Promise<BitBucketCloudPRComment[]> => {
getDangerMainComments = async (dangerID: string): Promise<BitBucketCloudPRComment[]> => {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

getDangerComments is a part of the interface for all API providers, so you probably shouldn't modify this implementation & rename it.

Would you mind either putting a helper in the BitBucketCloud.ts file (since that's the only place that is calling this getDangerMainComments method and/or duplicating the implementation (with your changes) into a new method?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think getDangerComments is a part of the interface because we only have this function in BitBucketServerAPI and BitBucketCloudAPI.

I believe the name getDangerComments would confused us, since we don't know if the result would be main comment or inline comment.

Moreover, we don't really have the usecase that we need both main comments, and inline comments at the same time, so I renamed it to getDangerMainComments

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This felt off to me also, but I think I see your reasoning 👍🏻

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds good! Sorry that i didn't dive deeper to verify my comments!

Co-authored-by: Frederic Barthelemy <git@fbartho.com>
@orta
Copy link
Member

orta commented Oct 12, 2020

👍🏻

@orta orta merged commit 9b28d2d into danger:master Oct 12, 2020
@orta
Copy link
Member

orta commented Oct 12, 2020

I'll make a release on the next PR

1 similar comment
@orta
Copy link
Member

orta commented Oct 12, 2020

I'll make a release on the next PR

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants