Skip to content

Commit 4dbc37a

Browse files
authored
Account for undefined user email (#5777)
Fixes #5326
1 parent 378b4d9 commit 4dbc37a

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

src/github/views.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ export interface PullRequest {
5757
* edit title/description, assign reviewers/labels etc.
5858
*/
5959
hasWritePermission: boolean;
60-
emailForCommit: string;
60+
emailForCommit?: string;
6161
pendingCommentText?: string;
6262
pendingCommentDrafts?: { [key: string]: string };
6363
pendingReviewType?: ReviewType;

webviews/components/merge.tsx

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -256,7 +256,7 @@ export const OfferToUpdate = ({ mergeable, isSimple, isCurrentlyCheckedOut, canU
256256
const update = () => {
257257
setBusy(true);
258258
updateBranch().finally(() => setBusy(false));
259-
}
259+
};
260260
if (!canUpdateBranch || !isCurrentlyCheckedOut || isSimple || mergeable === PullRequestMergeability.Behind || mergeable === PullRequestMergeability.Conflict || mergeable === PullRequestMergeability.Unknown) {
261261
return null;
262262
}
@@ -420,7 +420,7 @@ export const DeleteBranch = (pr: PullRequest) => {
420420
function ConfirmMerge({ pr, method, cancel }: { pr: PullRequest; method: MergeMethod; cancel: () => void }) {
421421
const { merge, updatePR, changeEmail } = useContext(PullRequestContext);
422422
const [isBusy, setBusy] = useState(false);
423-
423+
const emailForCommit = pr.emailForCommit;
424424
return (
425425
<div>
426426
<form id='merge-comment-form'
@@ -434,7 +434,7 @@ function ConfirmMerge({ pr, method, cancel }: { pr: PullRequest; method: MergeMe
434434
title: title?.value,
435435
description: description?.value,
436436
method,
437-
email: pr.emailForCommit
437+
email: emailForCommit
438438
});
439439
updatePR({ state });
440440
} finally {
@@ -444,13 +444,13 @@ function ConfirmMerge({ pr, method, cancel }: { pr: PullRequest; method: MergeMe
444444
>
445445
{method === 'rebase' ? null : (<input type="text" name="title" defaultValue={getDefaultTitleText(method, pr)} />)}
446446
{method === 'rebase' ? null : (<textarea name="description" defaultValue={getDefaultDescriptionText(method, pr)} />)}
447-
{method === 'rebase' ? null : (
447+
{(method === 'rebase' || !emailForCommit) ? null : (
448448
<div className='commit-association'>
449449
<span>
450450
Commit will be associated with <button className='input-box' title='Change email' aria-label='Change email' disabled={isBusy} onClick={() => {
451451
setBusy(true);
452-
changeEmail(pr.emailForCommit).finally(() => setBusy(false));
453-
}}>{pr.emailForCommit}</button>
452+
changeEmail(emailForCommit).finally(() => setBusy(false));
453+
}}>{emailForCommit}</button>
454454
</span>
455455
</div>
456456
)}

0 commit comments

Comments
 (0)