Merge pull request #12480 from desktop/fix-empty-commits

Render empty commits properly
This commit is contained in:
Sergio Padrino 2021-06-21 09:26:52 -07:00 committed by GitHub
commit b6ff09166e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 30 additions and 4 deletions

View file

@ -24,6 +24,7 @@ import {
DropTargetSelector,
DropTargetType,
} from '../../models/drag-drop'
import classNames from 'classnames'
interface ICommitProps {
readonly gitHubRepository: GitHubRepository | null
@ -131,6 +132,14 @@ export class CommitListItem extends React.PureComponent<
} = commit
const isDraggable = this.canCherryPick()
const hasEmptySummary = commit.summary.length === 0
const commitSummary = hasEmptySummary
? 'Empty commit message'
: commit.summary
const summaryClassNames = classNames('summary', {
'empty-summary': hasEmptySummary,
})
return (
<Draggable
@ -154,9 +163,9 @@ export class CommitListItem extends React.PureComponent<
>
<div className="info">
<RichText
className="summary"
className={summaryClassNames}
emoji={this.props.emoji}
text={commit.summary}
text={commitSummary}
renderUrlsAsLinks={false}
/>
<div className="description">

View file

@ -301,14 +301,23 @@ export class CommitSummary extends React.Component<
'hide-description-border': this.props.hideDescriptionBorder,
})
const hasEmptySummary = this.state.summary.length === 0
const commitSummary = hasEmptySummary
? 'Empty commit message'
: this.state.summary
const summaryClassNames = classNames('commit-summary-title', {
'empty-summary': hasEmptySummary,
})
return (
<div id="commit-summary" className={className}>
<div className="commit-summary-header">
<RichText
className="commit-summary-title"
className={summaryClassNames}
emoji={this.props.emoji}
repository={this.props.repository}
text={this.state.summary}
text={commitSummary}
/>
<ul className="commit-summary-meta">

View file

@ -104,6 +104,10 @@
.summary {
font-weight: var(--font-weight-semibold);
&.empty-summary {
color: var(--text-secondary-color);
}
}
.summary,

View file

@ -79,6 +79,10 @@
line-height: 16px;
padding: var(--spacing);
word-wrap: break-word;
&.empty-summary {
color: var(--text-secondary-color);
}
}
&-description-container {