mirror of
https://github.com/desktop/desktop
synced 2024-10-31 05:19:03 +00:00
fix showCommitLengthWarning property access
This commit is contained in:
parent
bc6c82fa51
commit
e782f45d6e
7 changed files with 33 additions and 7 deletions
|
@ -2173,6 +2173,7 @@ export class App extends React.Component<IAppProps, IAppState> {
|
|||
commitAuthor={repositoryState.commitAuthor}
|
||||
commitMessage={popup.commitMessage}
|
||||
commitSpellcheckEnabled={this.state.commitSpellcheckEnabled}
|
||||
showCommitLengthWarning={this.state.showCommitLengthWarning}
|
||||
dialogButtonText={popup.dialogButtonText}
|
||||
dialogTitle={popup.dialogTitle}
|
||||
dispatcher={this.props.dispatcher}
|
||||
|
@ -3268,6 +3269,7 @@ export class App extends React.Component<IAppProps, IAppState> {
|
|||
isShowingFoldout={this.state.currentFoldout !== null}
|
||||
aheadBehindStore={this.props.aheadBehindStore}
|
||||
commitSpellcheckEnabled={this.state.commitSpellcheckEnabled}
|
||||
showCommitLengthWarning={this.state.showCommitLengthWarning}
|
||||
onCherryPick={this.startCherryPickWithoutBranch}
|
||||
pullRequestSuggestedNextAction={state.pullRequestSuggestedNextAction}
|
||||
/>
|
||||
|
|
|
@ -51,6 +51,8 @@ interface IAutocompletingTextInputProps<ElementType, AutocompleteItemType> {
|
|||
/** Indicates if input field applies spellcheck */
|
||||
readonly spellcheck?: boolean
|
||||
|
||||
readonly showCommitLengthWarning?: boolean
|
||||
|
||||
/** Indicates if it should always try to autocomplete. Optional (defaults to false) */
|
||||
readonly alwaysAutocomplete?: boolean
|
||||
|
||||
|
|
|
@ -219,6 +219,8 @@ interface IChangesListProps {
|
|||
readonly shouldNudgeToCommit: boolean
|
||||
|
||||
readonly commitSpellcheckEnabled: boolean
|
||||
|
||||
readonly showCommitLengthWarning: boolean
|
||||
}
|
||||
|
||||
interface IChangesState {
|
||||
|
@ -818,6 +820,7 @@ export class ChangesList extends React.Component<
|
|||
showNoWriteAccess={fileCount > 0 && !hasWritePermissionForRepository}
|
||||
shouldNudge={this.props.shouldNudgeToCommit}
|
||||
commitSpellcheckEnabled={this.props.commitSpellcheckEnabled}
|
||||
showCommitLengthWarning={this.props.showCommitLengthWarning}
|
||||
onCoAuthorsUpdated={this.onCoAuthorsUpdated}
|
||||
onShowCoAuthoredByChanged={this.onShowCoAuthoredByChanged}
|
||||
onConfirmCommitWithUnknownCoAuthors={
|
||||
|
@ -829,6 +832,7 @@ export class ChangesList extends React.Component<
|
|||
onShowPopup={this.onShowPopup}
|
||||
onShowFoldout={this.onShowFoldout}
|
||||
onCommitSpellcheckEnabledChanged={this.onCommitSpellcheckEnabledChanged}
|
||||
onShowCommitLengthWarningChanged={this.onShowCommitLengthWarningChanged}
|
||||
onStopAmending={this.onStopAmending}
|
||||
onShowCreateForkDialog={this.onShowCreateForkDialog}
|
||||
/>
|
||||
|
@ -866,6 +870,9 @@ export class ChangesList extends React.Component<
|
|||
private onCommitSpellcheckEnabledChanged = (enabled: boolean) =>
|
||||
this.props.dispatcher.setCommitSpellcheckEnabled(enabled)
|
||||
|
||||
private onShowCommitLengthWarningChanged = (enabled: boolean) =>
|
||||
this.props.dispatcher.setShowCommitLengthWarning(enabled)
|
||||
|
||||
private onStopAmending = () =>
|
||||
this.props.dispatcher.stopAmendingRepository(this.props.repository)
|
||||
|
||||
|
|
|
@ -117,6 +117,9 @@ interface ICommitMessageProps {
|
|||
|
||||
readonly commitSpellcheckEnabled: boolean
|
||||
|
||||
readonly showCommitLengthWarning: boolean
|
||||
|
||||
|
||||
/** Optional text to override default commit button text */
|
||||
readonly commitButtonText?: string
|
||||
|
||||
|
@ -153,6 +156,7 @@ interface ICommitMessageProps {
|
|||
readonly onShowPopup: (popup: Popup) => void
|
||||
readonly onShowFoldout: (foldout: Foldout) => void
|
||||
readonly onCommitSpellcheckEnabledChanged: (enabled: boolean) => void
|
||||
readonly onShowCommitLengthWarningChanged: (enabled: boolean) => void
|
||||
readonly onStopAmending: () => void
|
||||
readonly onShowCreateForkDialog: () => void
|
||||
}
|
||||
|
@ -179,8 +183,6 @@ interface ICommitMessageState {
|
|||
|
||||
readonly isRuleFailurePopoverOpen: boolean
|
||||
|
||||
readonly showCommitLengthWarning: boolean
|
||||
|
||||
readonly repoRuleCommitMessageFailures: RepoRulesMetadataFailures
|
||||
readonly repoRuleCommitAuthorFailures: RepoRulesMetadataFailures
|
||||
readonly repoRuleBranchNameFailures: RepoRulesMetadataFailures
|
||||
|
@ -237,9 +239,6 @@ export class CommitMessage extends React.Component<
|
|||
isCommittingStatusMessage: '',
|
||||
repoRulesEnabled: false,
|
||||
isRuleFailurePopoverOpen: false,
|
||||
// TODO: do a proper retrieval rather than pinging localStorage (use AppState?)
|
||||
// (current solution requires a tab switch to hot reload)
|
||||
showCommitLengthWarning: localStorage.getItem("showCommitLengthWarning") === "1",
|
||||
repoRuleCommitMessageFailures: new RepoRulesMetadataFailures(),
|
||||
repoRuleCommitAuthorFailures: new RepoRulesMetadataFailures(),
|
||||
repoRuleBranchNameFailures: new RepoRulesMetadataFailures(),
|
||||
|
@ -1349,7 +1348,7 @@ export class CommitMessage extends React.Component<
|
|||
this.state.repoRuleCommitMessageFailures.status !== 'pass'
|
||||
|
||||
const showSummaryLengthHint =
|
||||
this.state.showCommitLengthWarning &&
|
||||
this.props.showCommitLengthWarning &&
|
||||
!showRepoRuleCommitMessageFailureHint &&
|
||||
this.state.summary.length > IdealSummaryLength
|
||||
|
||||
|
@ -1365,7 +1364,7 @@ export class CommitMessage extends React.Component<
|
|||
? this.COMMIT_MSG_ERROR_BTN_ID
|
||||
: undefined
|
||||
|
||||
const { placeholder, isCommitting, commitSpellcheckEnabled } = this.props
|
||||
const { placeholder, isCommitting, commitSpellcheckEnabled, showCommitLengthWarning } = this.props
|
||||
|
||||
return (
|
||||
// eslint-disable-next-line jsx-a11y/no-noninteractive-element-interactions
|
||||
|
@ -1394,6 +1393,7 @@ export class CommitMessage extends React.Component<
|
|||
onContextMenu={this.onAutocompletingInputContextMenu}
|
||||
readOnly={isCommitting === true}
|
||||
spellcheck={commitSpellcheckEnabled}
|
||||
showCommitLengthWarning={showCommitLengthWarning}
|
||||
/>
|
||||
{showRepoRuleCommitMessageFailureHint &&
|
||||
this.renderRepoRuleCommitMessageFailureHint()}
|
||||
|
@ -1421,6 +1421,7 @@ export class CommitMessage extends React.Component<
|
|||
onContextMenu={this.onAutocompletingInputContextMenu}
|
||||
readOnly={isCommitting === true}
|
||||
spellcheck={commitSpellcheckEnabled}
|
||||
showCommitLengthWarning={showCommitLengthWarning}
|
||||
/>
|
||||
{this.renderActionBar()}
|
||||
</FocusContainer>
|
||||
|
|
|
@ -78,6 +78,8 @@ interface IChangesSidebarProps {
|
|||
readonly shouldNudgeToCommit: boolean
|
||||
|
||||
readonly commitSpellcheckEnabled: boolean
|
||||
|
||||
readonly showCommitLengthWarning: boolean
|
||||
}
|
||||
|
||||
export class ChangesSidebar extends React.Component<IChangesSidebarProps, {}> {
|
||||
|
@ -432,6 +434,7 @@ export class ChangesSidebar extends React.Component<IChangesSidebarProps, {}> {
|
|||
currentBranchProtected={currentBranchProtected}
|
||||
shouldNudgeToCommit={this.props.shouldNudgeToCommit}
|
||||
commitSpellcheckEnabled={this.props.commitSpellcheckEnabled}
|
||||
showCommitLengthWarning={this.props.showCommitLengthWarning}
|
||||
currentRepoRulesInfo={currentRepoRulesInfo}
|
||||
aheadBehind={this.props.aheadBehind}
|
||||
/>
|
||||
|
|
|
@ -54,6 +54,8 @@ interface ICommitMessageDialogProps {
|
|||
*/
|
||||
readonly commitSpellcheckEnabled: boolean
|
||||
|
||||
readonly showCommitLengthWarning: boolean
|
||||
|
||||
/** Text for the ok button */
|
||||
readonly dialogButtonText: string
|
||||
|
||||
|
@ -140,6 +142,7 @@ export class CommitMessageDialog extends React.Component<
|
|||
aheadBehind={this.props.aheadBehind}
|
||||
showNoWriteAccess={this.props.showNoWriteAccess}
|
||||
commitSpellcheckEnabled={this.props.commitSpellcheckEnabled}
|
||||
showCommitLengthWarning={this.props.showCommitLengthWarning}
|
||||
onCoAuthorsUpdated={this.onCoAuthorsUpdated}
|
||||
onShowCoAuthoredByChanged={this.onShowCoAuthorsChanged}
|
||||
onConfirmCommitWithUnknownCoAuthors={
|
||||
|
@ -155,6 +158,9 @@ export class CommitMessageDialog extends React.Component<
|
|||
onCommitSpellcheckEnabledChanged={
|
||||
this.onCommitSpellcheckEnabledChanged
|
||||
}
|
||||
onShowCommitLengthWarningChanged={
|
||||
this.onShowCommitLengthWarningChanged
|
||||
}
|
||||
repositoryAccount={this.props.repositoryAccount}
|
||||
onStopAmending={this.onStopAmending}
|
||||
onShowCreateForkDialog={this.onShowCreateForkDialog}
|
||||
|
@ -187,6 +193,9 @@ export class CommitMessageDialog extends React.Component<
|
|||
private onCommitSpellcheckEnabledChanged = (enabled: boolean) =>
|
||||
this.props.dispatcher.setCommitSpellcheckEnabled(enabled)
|
||||
|
||||
private onShowCommitLengthWarningChanged = (enabled: boolean) =>
|
||||
this.props.dispatcher.setShowCommitLengthWarning(enabled)
|
||||
|
||||
private onStopAmending = () =>
|
||||
this.props.dispatcher.stopAmendingRepository(this.props.repository)
|
||||
|
||||
|
|
|
@ -54,6 +54,7 @@ interface IRepositoryViewProps {
|
|||
readonly askForConfirmationOnCheckoutCommit: boolean
|
||||
readonly focusCommitMessage: boolean
|
||||
readonly commitSpellcheckEnabled: boolean
|
||||
readonly showCommitLengthWarning: boolean
|
||||
readonly accounts: ReadonlyArray<Account>
|
||||
|
||||
/**
|
||||
|
@ -250,6 +251,7 @@ export class RepositoryView extends React.Component<
|
|||
this.props.currentTutorialStep === TutorialStep.MakeCommit
|
||||
}
|
||||
commitSpellcheckEnabled={this.props.commitSpellcheckEnabled}
|
||||
showCommitLengthWarning={this.props.showCommitLengthWarning}
|
||||
/>
|
||||
)
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue