Merge branch 'master' into changelog-for-1-3-0

This commit is contained in:
Brendan Forster 2018-07-27 10:26:54 -03:00 committed by GitHub
commit 572c1da0b1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 21 additions and 9 deletions

View file

@ -722,7 +722,7 @@ export class GitStore extends BaseStore {
}
/**
* The commit message to use based on the contex of the repository, e.g., the
* The commit message to use based on the context of the repository, e.g., the
* message from a recently undone commit.
*/
public get contextualCommitMessage(): ICommitMessage | null {

View file

@ -45,7 +45,7 @@ interface IChangesListProps {
summary: string,
description: string | null,
trailers?: ReadonlyArray<ITrailer>
) => Promise<void>
) => Promise<boolean>
readonly onDiscardChanges: (file: WorkingDirectoryFileChange) => void
readonly askForConfirmationOnDiscardChanges: boolean
readonly onDiscardAllChanges: (

View file

@ -38,7 +38,7 @@ interface ICommitMessageProps {
summary: string,
description: string | null,
trailers?: ReadonlyArray<ITrailer>
) => Promise<void>
) => Promise<boolean>
readonly branch: string | null
readonly commitAuthor: CommitIdentity | null
readonly gitHubUser: IGitHubUser | null
@ -224,8 +224,16 @@ export class CommitMessage extends React.Component<
this.setState({ description })
}
private onSubmit = () => {
this.createCommit()
private clearCommitMessage() {
this.setState({ summary: '', description: null })
}
private onSubmit = async () => {
const commitCreated = await this.createCommit()
if (commitCreated) {
this.clearCommitMessage()
}
}
private getCoAuthorTrailers() {
@ -239,16 +247,16 @@ export class CommitMessage extends React.Component<
}))
}
private async createCommit() {
private async createCommit(): Promise<boolean> {
const { summary, description } = this.state
if (!this.canCommit()) {
return
return false
}
const trailers = this.getCoAuthorTrailers()
await this.props.onCreateCommit(summary, description, trailers)
return await this.props.onCreateCommit(summary, description, trailers)
}
private canCommit(): boolean {

View file

@ -116,7 +116,7 @@ export class ChangesSidebar extends React.Component<IChangesSidebarProps, {}> {
summary: string,
description: string | null,
trailers?: ReadonlyArray<ITrailer>
): Promise<void> => {
): Promise<boolean> => {
const commitCreated = await this.props.dispatcher.commitIncludedChanges(
this.props.repository,
summary,
@ -127,6 +127,8 @@ export class ChangesSidebar extends React.Component<IChangesSidebarProps, {}> {
if (commitCreated) {
this.props.dispatcher.setCommitMessage(this.props.repository, null)
}
return commitCreated
}
private onFileSelectionChanged = (rows: ReadonlyArray<number>) => {

View file

@ -23,6 +23,8 @@
"[Improved] Diff gutter elements should be considered button elements when interacting - #5158",
"[Improved] Repository list badge style tweaks and tweaks for dark theme - #5095",
"[Improved] Status parsing significantly more performant when handling thousands of changed files - #2449 #5186"
"1.3.0-beta6": [
],
"1.3.0-beta5": [
"[Fixed] Ensure commit message is cleared after successful commit - #4046",