Merge pull request #12817 from desktop/fix-cherry-pick-undo

Fix `Undo` link not showing up for cherry-picks
This commit is contained in:
tidy-dev 2021-08-23 07:34:25 -04:00 committed by GitHub
commit 52102a706e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 5 additions and 9 deletions

View file

@ -60,7 +60,7 @@ export type Banner =
/** number of commits cherry picked */
readonly count: number
/** callback to run when user clicks undo link in banner */
readonly onUndoCherryPick: () => void
readonly onUndo: () => void
}
| {
readonly type: BannerType.CherryPickConflictsFound

View file

@ -79,7 +79,7 @@ export function renderBanner(
targetBranchName={banner.targetBranchName}
countCherryPicked={banner.count}
onDismissed={onDismissed}
onUndoCherryPick={banner.onUndoCherryPick}
onUndo={banner.onUndo}
/>
)
case BannerType.CherryPickConflictsFound:

View file

@ -5,7 +5,7 @@ interface ISuccessfulCherryPickBannerProps {
readonly targetBranchName: string
readonly countCherryPicked: number
readonly onDismissed: () => void
readonly onUndoCherryPick: () => void
readonly onUndo: () => void
}
export class SuccessfulCherryPick extends React.Component<
@ -16,18 +16,14 @@ export class SuccessfulCherryPick extends React.Component<
const {
countCherryPicked,
onDismissed,
onUndoCherryPick,
onUndo,
targetBranchName,
} = this.props
const pluralized = countCherryPicked === 1 ? 'commit' : 'commits'
return (
<SuccessBanner
timeout={15000}
onDismissed={onDismissed}
onUndo={onUndoCherryPick}
>
<SuccessBanner timeout={15000} onDismissed={onDismissed} onUndo={onUndo}>
<span>
Successfully copied {countCherryPicked} {pluralized} to{' '}
<strong>{targetBranchName}</strong>.