Skip to content

Commit 25661cb

Browse files
committed
move some stuff
1 parent 24a97b6 commit 25661cb

1 file changed

Lines changed: 12 additions & 15 deletions

File tree

webviews/components/merge.tsx

Lines changed: 12 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -281,9 +281,8 @@ export const OfferToUpdate = ({ mergeable, isSimple, isCurrentlyCheckedOut, canU
281281

282282
};
283283

284-
export const ReadyForReview = ({ isSimple, showMergeButton, mergeMethod }: { isSimple: boolean; showMergeButton?: boolean; mergeMethod?: MergeMethod }) => {
284+
export const ReadyForReview = ({ isSimple, isCopilotOnMyBehalf, mergeMethod }: { isSimple: boolean; isCopilotOnMyBehalf?: boolean; mergeMethod: MergeMethod }) => {
285285
const [isBusy, setBusy] = useState(false);
286-
const [isMergeBusy, setMergeBusy] = useState(false);
287286
const { readyForReview, readyForReviewAndMerge, updatePR } = useContext(PullRequestContext);
288287

289288
const markReadyForReview = useCallback(async () => {
@@ -298,13 +297,13 @@ export const ReadyForReview = ({ isSimple, showMergeButton, mergeMethod }: { isS
298297

299298
const markReadyAndMerge = useCallback(async () => {
300299
try {
301-
setMergeBusy(true);
302-
const result = await readyForReviewAndMerge({ mergeMethod: mergeMethod || 'squash' });
300+
setBusy(true);
301+
const result = await readyForReviewAndMerge({ mergeMethod: mergeMethod });
303302
updatePR(result);
304303
} finally {
305-
setMergeBusy(false);
304+
setBusy(false);
306305
}
307-
}, [setMergeBusy, readyForReviewAndMerge, updatePR, mergeMethod]);
306+
}, [readyForReviewAndMerge, updatePR, mergeMethod]);
308307

309308
return (
310309
<div className="ready-for-review-container">
@@ -316,18 +315,18 @@ export const ReadyForReview = ({ isSimple, showMergeButton, mergeMethod }: { isS
316315
</div>
317316
</div>
318317
<div className='button-container'>
319-
<button disabled={isBusy || isMergeBusy} onClick={markReadyForReview}>Ready for Review</button>
320-
{showMergeButton && (
318+
{isCopilotOnMyBehalf && (
321319
<button
322320
className="secondary"
323-
disabled={isBusy || isMergeBusy}
321+
disabled={isBusy}
324322
onClick={markReadyAndMerge}
325-
title="Mark as ready for review, approve, and enable auto-merge with squash"
323+
title="Mark as ready for review, approve, and enable auto-merge with default merge method"
326324
aria-label="Ready for Review, Approve, and Auto-Merge"
327325
>
328326
Ready &amp; Merge
329327
</button>
330328
)}
329+
<button disabled={isBusy} onClick={markReadyForReview}>Ready for Review</button>
331330
</div>
332331
</div>
333332
);
@@ -360,16 +359,14 @@ export const Merge = (pr: PullRequest) => {
360359
};
361360

362361
export const PrActions = ({ pr, isSimple }: { pr: PullRequest; isSimple: boolean }) => {
363-
const { hasWritePermission, canEdit, isDraft, mergeable, isCopilotOnMyBehalf, mergeMethodsAvailability } = pr;
362+
const { hasWritePermission, canEdit, isDraft, mergeable, isCopilotOnMyBehalf, defaultMergeMethod } = pr;
364363
if (isDraft) {
365364
// Only PR author and users with push rights can mark draft as ready for review
366365
if (!canEdit) {
367366
return null;
368367
}
369-
370-
// For Copilot-created PRs, show the "Ready & Merge" button alongside the regular button
371-
const showMergeButton = isCopilotOnMyBehalf && mergeMethodsAvailability.squash;
372-
return <ReadyForReview isSimple={isSimple} showMergeButton={showMergeButton} mergeMethod="squash" />;
368+
369+
return <ReadyForReview isSimple={isSimple} isCopilotOnMyBehalf={isCopilotOnMyBehalf} mergeMethod={defaultMergeMethod} />;
373370
}
374371

375372
if (mergeable === PullRequestMergeability.Mergeable && hasWritePermission && !pr.mergeQueueEntry) {

0 commit comments

Comments
 (0)