Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 22 additions & 1 deletion app/src/ui/changes/changes-list.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -317,7 +317,7 @@ export class ChangesList extends React.Component<
event.preventDefault()

// need to preserve the working directory state while dealing with conflicts
if (this.props.rebaseConflictState !== null) {
if (this.props.rebaseConflictState !== null || this.props.isCommitting) {
return
}

Expand Down Expand Up @@ -514,6 +514,10 @@ export class ChangesList extends React.Component<
file: WorkingDirectoryFileChange,
event: React.MouseEvent<HTMLDivElement>
) => {
if (this.props.isCommitting) {
return
}

event.preventDefault()

const items =
Expand Down Expand Up @@ -663,6 +667,22 @@ export class ChangesList extends React.Component<
)
}

private onRowKeyDown = (
_row: number,
event: React.KeyboardEvent<HTMLDivElement>
) => {
// The commit is already in-flight but this check prevents the
// user from changing selection.
if (
this.props.isCommitting &&
(event.key === 'Enter' || event.key === ' ')
) {
event.preventDefault()
}

return
}

public render() {
const fileCount = this.props.workingDirectory.files.length
const filesPlural = fileCount === 1 ? 'file' : 'files'
Expand Down Expand Up @@ -699,6 +719,7 @@ export class ChangesList extends React.Component<
onRowClick={this.props.onRowClick}
onScroll={this.onScroll}
setScrollTop={this.props.changesListScrollTop}
onRowKeyDown={this.onRowKeyDown}
/>
{this.renderStashedChanges()}
{this.renderCommitMessageForm()}
Expand Down
6 changes: 5 additions & 1 deletion app/src/ui/changes/changes.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ interface IChangesProps {
readonly diff: IDiff
readonly dispatcher: Dispatcher
readonly imageDiffType: ImageDiffType

/** Whether a commit is in progress */
readonly isCommitting: boolean
Comment thread
iAmWillShepherd marked this conversation as resolved.
Resolved
}

export class Changes extends React.Component<IChangesProps, {}> {
Expand All @@ -27,6 +30,7 @@ export class Changes extends React.Component<IChangesProps, {}> {
public render() {
const diff = this.props.diff
const file = this.props.file
const isCommitting = this.props.isCommitting
return (
<div className="changed-file">
<ChangedFileDetails
Expand All @@ -41,7 +45,7 @@ export class Changes extends React.Component<IChangesProps, {}> {
repository={this.props.repository}
imageDiffType={this.props.imageDiffType}
file={file}
readOnly={false}
readOnly={isCommitting}
onIncludeChanged={this.onDiffLineIncludeChanged}
diff={diff}
dispatcher={this.props.dispatcher}
Expand Down
1 change: 1 addition & 0 deletions app/src/ui/changes/sidebar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -318,6 +318,7 @@ export class ChangesSidebar extends React.Component<IChangesSidebarProps, {}> {
commit={commit}
onUndo={this.onUndo}
emoji={this.props.emoji}
isCommitting={this.props.isCommitting}
/>
)
}
Expand Down
6 changes: 5 additions & 1 deletion app/src/ui/changes/undo-commit.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,16 @@ interface IUndoCommitProps {

/** whether a push, pull or fetch is in progress */
readonly isPushPullFetchInProgress: boolean

/** whether a committing is in progress */
readonly isCommitting: boolean
}

/** The Undo Commit component. */
export class UndoCommit extends React.Component<IUndoCommitProps, {}> {
public render() {
const disabled = this.props.isPushPullFetchInProgress
const disabled =
this.props.isPushPullFetchInProgress || this.props.isCommitting
const title = disabled
? 'Undo is disabled while the repository is being updated'
: undefined
Expand Down
1 change: 1 addition & 0 deletions app/src/ui/repository.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -321,6 +321,7 @@ export class RepositoryView extends React.Component<
dispatcher={this.props.dispatcher}
file={selectedFile}
diff={diff}
isCommitting={this.props.state.isCommitting}
imageDiffType={this.props.imageDiffType}
/>
)
Expand Down