Fix cross-deleted-pr-branches on deleted repositories - #4214
Conversation
This comment has been minimized.
This comment has been minimized.
| @@ -8,29 +8,29 @@ import features from '.'; | |||
|
|
|||
| function init(): void | false { | |||
| const lastBranchAction = select.last('.TimelineItem-body .user-select-contain > span:not(.base-ref)'); | |||
There was a problem hiding this comment.
Does this work?
| const lastBranchAction = select.last('.TimelineItem-body .user-select-contain > span:not(.base-ref)'); | |
| const lastBranchAction = select.last('.TimelineItem-body .user-select-contain > .head-ref'); |
There was a problem hiding this comment.
No it will fail here #271
Since the deleted branch does not have .head-ref after its deleted
There was a problem hiding this comment.
Indeed, how about this?
| const lastBranchAction = select.last('.TimelineItem-body .user-select-contain > span:not(.base-ref)'); | |
| const lastBranchAction = select.last('.TimelineItem-body .commit-ref'); |
There was a problem hiding this comment.
No that was not good. We only want if they deleted, that gives any action with a commit ref.
There was a problem hiding this comment.
If a branch has been deleted, there are no other commit refs afterwards, I think
There was a problem hiding this comment.
In jquery/jquery#769 it selects the base branch but then it's filtered out by the next check (
!includes(' deleted '))
Great!
There was a problem hiding this comment.
In jquery/jquery#769 it selects the base branch but then it's filtered out by the next check (
!includes(' deleted '))
Just realized that will cause a return false.
If we add :not(.base-ref) it will exclude it.
There was a problem hiding this comment.
Just realized that will cause a return false.
And? If the last event is not a deletion, then the branch hasn't been deleted. That PR is locked, so even if it's deleted, we can't detect that.
There was a problem hiding this comment.
Everything is working fine, nothing is broken. The only thing is the feature logger.
As we did the following.
if (!headReferenceLink && !lastBranchAction) {
return; // Don't return false, This feature’s CSS already takes care of this
}There was a problem hiding this comment.
@fregante if this is a non-issue, lets merge this.
cross-deleted-pr-branches on delete repositoriescross-deleted-pr-branches on deleted repositories
Co-authored-by: Federico Brigante <me@fregante.com>
Co-authored-by: Federico Brigante <me@fregante.com>
Test URLs
Screenshot
FYI: GitHub used to display 'unknown repository' they no longer do that