Skip to content

Conversation

@yakov116
Copy link
Member

@yakov116 yakov116 added the bug label Jan 10, 2021
@yakov116 yakov116 requested a review from fregante January 10, 2021 03:11
if (!canMerge && !isDraftPR) {
const hasConflicts = select.exists('.js-merge-pr a[href$="/conflicts"]');

if ((!canMerge && !isDraftPR) || hasConflicts) {
Copy link
Member

Choose a reason for hiding this comment

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

The logic overlaps, maybe the whole block should be be rewritten because the core logic is "if has conflicts or can not merge, return"

We already have hasConflicts but can we determine whether "it can merge" in a single selector? Without also checking specifically for draft PRs.

There are 8 situations to be tested, combinations of:

  • PR state: regular or draft
  • user: collaborator or third party
  • conflicts: yes or no

Note: these are situations to be tested, not conditions that should appear in the code

This comment was marked as resolved.

Copy link
Member

@fregante fregante Jan 10, 2021

Choose a reason for hiding this comment

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

Why are we checking if its a draft PR?

That's what I'm saying. We shouldn't.

the core logic is "if has conflicts or can not merge, return"

Without also checking specifically for draft PRs.

Copy link
Member

@fregante fregante Jan 11, 2021

Choose a reason for hiding this comment

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

This doesn't work on draft PRs at all now because the button is always :disabled there

@fregante
Copy link
Member

I think our canMerge logic is incorrect. Even if you cannot merge, if you can push to the branch you can certainly update it.

We should replace it with canPush. I think that this text should be a good indicator, it appears on:

  • repo owner: me, PR opener: me
  • repo owner: other, PR opener: me
  • repo owner: other, PR opener: other, but I'm a collaborator

Screen Shot 3

Maybe the selector is this? .merge-pr > .text-gray:first-child

@fregante
Copy link
Member

I don't see "Update branch" here: #3839

I think the logic suggested above would fix it

@fregante
Copy link
Member

We should replace it with canPush

Comment on lines 95 to 96
// Button exists when the current user can merge the PR.
// Button is disabled when there are conflicts (there's already a native "Resolve conflicts" button)
Copy link
Member

Choose a reason for hiding this comment

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

?

@fregante fregante marked this pull request as draft January 12, 2021 07:40
Copy link
Member

@fregante fregante left a comment

Choose a reason for hiding this comment

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

Please send complete PRs

@fregante fregante marked this pull request as ready for review January 12, 2021 07:43
@fregante fregante merged commit cd2788a into master Jan 12, 2021
@fregante fregante deleted the dont-update-branch-on-conflict branch January 12, 2021 07:48
@yakov116
Copy link
Member Author

Not sure if this PR did it.

But #3904 has update base branch 3 times

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

Labels

Development

Successfully merging this pull request may close these issues.

update-pr-from-base-branch shouldn't appear when there's a "Resolve conflicts" button

2 participants