diff --git a/app/src/ui/changes/commit-message.tsx b/app/src/ui/changes/commit-message.tsx
index 165ad37f88b..95417684d53 100644
--- a/app/src/ui/changes/commit-message.tsx
+++ b/app/src/ui/changes/commit-message.tsx
@@ -94,10 +94,34 @@ function formatConfigOriginTooltip(
fieldName: string,
origin: IConfigValueOrigin,
repositoryPath: string,
- onRevealFile: () => void
+ onRevealFile: () => void,
+ warningMessage?: string,
+ warningAccountLogin?: string,
+ onOpenRepositoryRemoteSettings?: () => void
): JSX.Element {
return (
+ {warningMessage && warningAccountLogin && (
+ <>
+
+
+
+
+ {warningMessage}
+
+
+
+ Repository is linked to @{warningAccountLogin}
+
+
+
+ Change account in{' '}
+
+ repository settings
+
+
+ >
+ )}
{fieldName}:
{origin.value}
Scope:
@@ -842,6 +866,13 @@ export class CommitMessage extends React.Component<
const { commitAuthorNameOrigin, commitAuthorEmailOrigin } = this.props
const repoPath = this.props.repository.path
+ const isMisattributed = warningType === 'misattribution'
+ const warningMessage = isMisattributed
+ ? 'Email does not match linked account'
+ : undefined
+ const warningAccountLogin = isMisattributed
+ ? repositoryAccount?.login
+ : undefined
const nameTooltip = commitAuthorNameOrigin
? formatConfigOriginTooltip(
'Name',
@@ -855,12 +886,22 @@ export class CommitMessage extends React.Component<
'Email',
commitAuthorEmailOrigin,
repoPath,
- this.onRevealEmailConfigFile
+ this.onRevealEmailConfigFile,
+ warningMessage,
+ warningAccountLogin,
+ this.onOpenRepositoryRemoteSettings
)
: undefined
+ const identityClasses = classNames('commit-author-identity', {
+ warning: isMisattributed,
+ })
+ const emailClasses = classNames('commit-author-email', {
+ warning: isMisattributed,
+ })
+
return (
-
+
{avatar}
{
+ this.props.onShowPopup({
+ type: PopupType.RepositorySettings,
+ repository: this.props.repository,
+ initialSelectedTab: RepositorySettingsTab.Remote,
+ })
+ }
+
private onOpenGitSettings = () => {
this.props.onShowPopup({
type: PopupType.Preferences,
diff --git a/app/styles/ui/changes/_commit-message.scss b/app/styles/ui/changes/_commit-message.scss
index 16e32f0106b..ec64db980c7 100644
--- a/app/styles/ui/changes/_commit-message.scss
+++ b/app/styles/ui/changes/_commit-message.scss
@@ -87,6 +87,11 @@
gap: var(--spacing-half);
margin-bottom: var(--spacing-half);
+ &.warning {
+ border-left: 2px solid var(--input-icon-warning-color);
+ padding-left: var(--spacing-half);
+ }
+
.commit-author-info {
display: flex;
flex-direction: column;
@@ -105,6 +110,10 @@
color: var(--text-secondary-color);
@include ellipsis;
cursor: default;
+
+ &.warning {
+ color: var(--input-warning-text-color);
+ }
}
}
}
diff --git a/app/styles/ui/window/_tooltips.scss b/app/styles/ui/window/_tooltips.scss
index 9c2cffb72c4..110c0f97d1a 100644
--- a/app/styles/ui/window/_tooltips.scss
+++ b/app/styles/ui/window/_tooltips.scss
@@ -222,6 +222,28 @@ body > .tooltip,
font-weight: bold;
text-align: right;
}
+
+ .config-origin-tooltip-warning-icon {
+ color: var(--input-icon-warning-color);
+ grid-row: span 3;
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ }
+
+ .config-origin-tooltip-warning {
+ color: var(--input-icon-warning-color);
+ font-size: var(--font-size-sm);
+ }
+
+ .config-origin-tooltip-spacer {
+ // Empty first-column cell in the warning grid rows
+ }
+
+ .config-origin-tooltip-hint {
+ font-size: var(--font-size-xs);
+ color: var(--input-icon-warning-color);
+ }
}
}