- {this.props.buttonContent}
+ {buttonContent}
{this.renderPopover()}
diff --git a/app/styles/ui/_branch-select.scss b/app/styles/ui/_branch-select.scss
index 38c9a62fc8..c0ae93fd27 100644
--- a/app/styles/ui/_branch-select.scss
+++ b/app/styles/ui/_branch-select.scss
@@ -1,66 +1,9 @@
.branch-select-component {
- display: inline-flex;
+ display: inline;
.base-label {
font-weight: var(--font-weight-semibold);
color: var(--text-secondary-color);
margin: 0 var(--spacing-half);
}
-
- button {
- border: none;
- background-color: inherit;
- border: none;
- padding: 0;
- margin: 0;
- font-style: normal;
- font-family: var(--font-family-monospace);
-
- .ref-component {
- padding: 1px;
- }
-
- &.button-component {
- overflow: visible;
-
- &:hover,
- &:focus {
- border: none;
- box-shadow: none;
-
- .ref-component {
- border-color: var(--path-segment-background-focus);
- box-shadow: 0 0 0 1px var(--path-segment-background-focus);
- }
- }
- }
- }
-
- .ref-component {
- display: inline-flex;
- align-items: center;
- }
-
- .branch-select-dropdown {
- position: absolute;
- min-height: 200px;
- width: 365px;
- padding: 0;
- margin-top: 25px;
-
- .branch-select-dropdown-header {
- padding: var(--spacing);
- font-weight: var(--font-weight-semibold);
- display: flex;
- border-bottom: var(--base-border);
-
- .close {
- margin-right: 0;
- }
- }
-
- .branch-select-dropdown-list {
- display: flex;
- }
- }
}
diff --git a/app/styles/ui/_popover-dropdown.scss b/app/styles/ui/_popover-dropdown.scss
index a7999447c0..178674cb77 100644
--- a/app/styles/ui/_popover-dropdown.scss
+++ b/app/styles/ui/_popover-dropdown.scss
@@ -7,8 +7,9 @@
border: none;
padding: 0;
margin: 0;
- color: #149ad4;
+ color: var(--link-button-color);
font-weight: bold;
+ text-decoration: underline;
&.button-component {
overflow: visible;
From c59263b92ba75b4ad5362f6493b9331839e40389 Mon Sep 17 00:00:00 2001
From: tidy-dev <75402236+tidy-dev@users.noreply.github.com>
Date: Thu, 22 Sep 2022 12:50:23 -0400
Subject: [PATCH 028/262] Add diff options component
---
app/src/ui/changes/changed-file-details.tsx | 3 +--
app/src/ui/diff/diff-options.tsx | 5 ++---
app/src/ui/history/commit-summary.tsx | 3 +--
.../pull-request-files-changed.tsx | 19 +++++++++++++++++++
4 files changed, 23 insertions(+), 7 deletions(-)
diff --git a/app/src/ui/changes/changed-file-details.tsx b/app/src/ui/changes/changed-file-details.tsx
index b47b7d2918..cab1ce5d52 100644
--- a/app/src/ui/changes/changed-file-details.tsx
+++ b/app/src/ui/changes/changed-file-details.tsx
@@ -6,7 +6,6 @@ import { Octicon, iconForStatus } from '../octicons'
import * as OcticonSymbol from '../octicons/octicons.generated'
import { mapStatus } from '../../lib/status'
import { DiffOptions } from '../diff/diff-options'
-import { RepositorySectionTab } from '../../lib/app-state'
interface IChangedFileDetailsProps {
readonly path: string
@@ -61,7 +60,7 @@ export class ChangedFileDetails extends React.Component<
return (
- {this.props.sourceTab === RepositorySectionTab.Changes && (
+ {this.props.isInteractiveDiff && (
Interacting with individual lines or hunks will be disabled while
hiding whitespace.
diff --git a/app/src/ui/history/commit-summary.tsx b/app/src/ui/history/commit-summary.tsx
index 2182f63011..af82a4156e 100644
--- a/app/src/ui/history/commit-summary.tsx
+++ b/app/src/ui/history/commit-summary.tsx
@@ -12,7 +12,6 @@ import { CommitAttribution } from '../lib/commit-attribution'
import { Tokenizer, TokenResult } from '../../lib/text-token-parser'
import { wrapRichTextCommitMessage } from '../../lib/wrap-rich-text-commit-message'
import { DiffOptions } from '../diff/diff-options'
-import { RepositorySectionTab } from '../../lib/app-state'
import { IChangesetData } from '../../lib/git'
import { TooltippedContent } from '../lib/tooltipped-content'
import { AppFileStatusKind } from '../../models/status'
@@ -505,7 +504,7 @@ export class CommitSummary extends React.Component<
title="Diff Options"
>
{
+ this.props.dispatcher.onShowSideBySideDiffChanged(showSideBySideDiff)
+ }
+
+ private onDiffOptionsOpened = () => {
+ this.props.dispatcher.recordDiffOptionsViewed()
+ }
+
/**
* Called when the user is viewing an image diff and requests
* to change the diff presentation mode.
@@ -209,6 +218,16 @@ export class PullRequestFilesChanged extends React.Component<
return (
Showing changes from all commits
+
+
+
)
}
From a0e9ea9ec2492366d1a82ad2db3f64cedccd4b2f Mon Sep 17 00:00:00 2001
From: tidy-dev <75402236+tidy-dev@users.noreply.github.com>
Date: Thu, 22 Sep 2022 12:54:47 -0400
Subject: [PATCH 029/262] Display settings to right
Also rename style file name to match component name
---
.../pull-request-files-changed.tsx | 22 +++++++++----------
app/styles/_ui.scss | 2 +-
....scss => _pull-request-files-changed.scss} | 5 +++++
3 files changed, 17 insertions(+), 12 deletions(-)
rename app/styles/ui/{_pull-request-diff.scss => _pull-request-files-changed.scss} (78%)
diff --git a/app/src/ui/open-pull-request/pull-request-files-changed.tsx b/app/src/ui/open-pull-request/pull-request-files-changed.tsx
index f2b4af91de..868ac1044f 100644
--- a/app/src/ui/open-pull-request/pull-request-files-changed.tsx
+++ b/app/src/ui/open-pull-request/pull-request-files-changed.tsx
@@ -217,17 +217,17 @@ export class PullRequestFilesChanged extends React.Component<
private renderHeader() {
return (
-
Showing changes from all commits
-
-
-
+
+ Showing changes from all commits
+
+
)
}
diff --git a/app/styles/_ui.scss b/app/styles/_ui.scss
index 99b8c5aeb0..53c78ec973 100644
--- a/app/styles/_ui.scss
+++ b/app/styles/_ui.scss
@@ -100,5 +100,5 @@
@import 'ui/discard-changes-retry';
@import 'ui/_git-email-not-found-warning';
@import 'ui/_branch-select';
-@import 'ui/_pull-request-diff';
@import 'ui/_popover-dropdown';
+@import 'ui/_pull-request-files-changed';
diff --git a/app/styles/ui/_pull-request-diff.scss b/app/styles/ui/_pull-request-files-changed.scss
similarity index 78%
rename from app/styles/ui/_pull-request-diff.scss
rename to app/styles/ui/_pull-request-files-changed.scss
index 69954b1f55..ef3555c387 100644
--- a/app/styles/ui/_pull-request-diff.scss
+++ b/app/styles/ui/_pull-request-files-changed.scss
@@ -5,6 +5,11 @@
.files-changed-header {
padding: var(--spacing);
border-bottom: var(--base-border);
+ display: flex;
+
+ .commits-displayed {
+ flex-grow: 1;
+ }
}
.files-diff-viewer {
From 82b1c682ab8fbc82b4dcde8ac74470af7d981bd7 Mon Sep 17 00:00:00 2001
From: tidy-dev <75402236+tidy-dev@users.noreply.github.com>
Date: Thu, 22 Sep 2022 12:56:59 -0400
Subject: [PATCH 030/262] Tidying
---
app/src/ui/open-pull-request/pull-request-files-changed.tsx | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/app/src/ui/open-pull-request/pull-request-files-changed.tsx b/app/src/ui/open-pull-request/pull-request-files-changed.tsx
index 868ac1044f..6a8921e261 100644
--- a/app/src/ui/open-pull-request/pull-request-files-changed.tsx
+++ b/app/src/ui/open-pull-request/pull-request-files-changed.tsx
@@ -215,6 +215,7 @@ export class PullRequestFilesChanged extends React.Component<
}
private renderHeader() {
+ const { hideWhitespaceInDiff, showSideBySideDiff } = this.props
return (
@@ -222,9 +223,9 @@ export class PullRequestFilesChanged extends React.Component<
From 147120897b306d47863e3e6ea4a8568fa2be6b15 Mon Sep 17 00:00:00 2001
From: tidy-dev <75402236+tidy-dev@users.noreply.github.com>
Date: Thu, 22 Sep 2022 13:25:34 -0400
Subject: [PATCH 031/262] Get the diff state variables off the current state
---
app/src/ui/app.tsx | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/app/src/ui/app.tsx b/app/src/ui/app.tsx
index ad04787b84..4a6e1a1caa 100644
--- a/app/src/ui/app.tsx
+++ b/app/src/ui/app.tsx
@@ -2259,17 +2259,19 @@ export class App extends React.Component
{
return null
}
- const { pullRequestFilesListWidth } = this.state
+ const {
+ pullRequestFilesListWidth,
+ hideWhitespaceInHistoryDiff,
+ showSideBySideDiff,
+ } = this.state
const {
allBranches,
currentBranch,
defaultBranch,
imageDiffType,
- hideWhitespaceInHistoryDiff,
externalEditorLabel,
nonLocalCommitSHA,
- showSideBySideDiff,
recentBranches,
repository,
} = popup
From e3165804529c33f526d957f03d35fcfd9101f1da Mon Sep 17 00:00:00 2001
From: tidy-dev <75402236+tidy-dev@users.noreply.github.com>
Date: Thu, 22 Sep 2022 13:54:17 -0400
Subject: [PATCH 032/262] Remove state tracked variables from popover
---
app/src/lib/stores/app-store.ts | 9 +--------
app/src/models/popup.ts | 2 --
2 files changed, 1 insertion(+), 10 deletions(-)
diff --git a/app/src/lib/stores/app-store.ts b/app/src/lib/stores/app-store.ts
index 2c30b2afd4..7ad2314c38 100644
--- a/app/src/lib/stores/app-store.ts
+++ b/app/src/lib/stores/app-store.ts
@@ -7242,23 +7242,16 @@ export class AppStore extends TypedBaseStore {
}
const { allBranches, recentBranches } = branchesState
- const {
- imageDiffType,
- hideWhitespaceInHistoryDiff,
- showSideBySideDiff,
- selectedExternalEditor,
- } = this.getState()
+ const { imageDiffType, selectedExternalEditor } = this.getState()
this._showPopup({
type: PopupType.StartPullRequest,
allBranches,
currentBranch,
defaultBranch,
- hideWhitespaceInHistoryDiff,
imageDiffType,
recentBranches,
repository,
- showSideBySideDiff,
externalEditorLabel: selectedExternalEditor ?? undefined,
nonLocalCommitSHA:
commitSHAs.length > 0 && !localCommitSHAs.includes(commitSHAs[0])
diff --git a/app/src/models/popup.ts b/app/src/models/popup.ts
index 188d8f0b0c..dfca4a6a28 100644
--- a/app/src/models/popup.ts
+++ b/app/src/models/popup.ts
@@ -366,10 +366,8 @@ export type Popup =
currentBranch: Branch
defaultBranch: Branch | null
externalEditorLabel?: string
- hideWhitespaceInHistoryDiff: boolean
imageDiffType: ImageDiffType
recentBranches: ReadonlyArray
repository: Repository
- showSideBySideDiff: boolean
nonLocalCommitSHA: string | null
}
From 5be997fa708a1d0f5b107ab931cedc45333af245 Mon Sep 17 00:00:00 2001
From: tidy-dev <75402236+tidy-dev@users.noreply.github.com>
Date: Thu, 22 Sep 2022 14:10:41 -0400
Subject: [PATCH 033/262] Add hideWhitespaceinPullRequestDiff tracking
---
app/src/lib/app-state.ts | 3 +++
app/src/lib/stores/app-store.ts | 24 ++++++++++++++++++-
app/src/ui/app.tsx | 4 ++--
app/src/ui/diff/diff-options.tsx | 2 +-
app/src/ui/dispatcher/dispatcher.ts | 13 ++++++++++
.../pull-request-files-changed.tsx | 4 ++--
6 files changed, 44 insertions(+), 6 deletions(-)
diff --git a/app/src/lib/app-state.ts b/app/src/lib/app-state.ts
index 35a697597b..6b99e1ef19 100644
--- a/app/src/lib/app-state.ts
+++ b/app/src/lib/app-state.ts
@@ -233,6 +233,9 @@ export interface IAppState {
/** Whether we should hide white space changes in history diff */
readonly hideWhitespaceInHistoryDiff: boolean
+ /** Whether we should hide white space changes in the pull request diff */
+ readonly hideWhitespaceInPullRequestDiff: boolean
+
/** Whether we should show side by side diffs */
readonly showSideBySideDiff: boolean
diff --git a/app/src/lib/stores/app-store.ts b/app/src/lib/stores/app-store.ts
index 7ad2314c38..970bcd9490 100644
--- a/app/src/lib/stores/app-store.ts
+++ b/app/src/lib/stores/app-store.ts
@@ -351,6 +351,8 @@ const hideWhitespaceInChangesDiffDefault = false
const hideWhitespaceInChangesDiffKey = 'hide-whitespace-in-changes-diff'
const hideWhitespaceInHistoryDiffDefault = false
const hideWhitespaceInHistoryDiffKey = 'hide-whitespace-in-diff'
+const hideWhitespaceInPullRequestDiffDefault = false
+const hideWhitespaceInPullRequestDiffKey = 'hide-whitespace-in-diff'
const commitSpellcheckEnabledDefault = true
const commitSpellcheckEnabledKey = 'commit-spellcheck-enabled'
@@ -448,6 +450,8 @@ export class AppStore extends TypedBaseStore {
hideWhitespaceInChangesDiffDefault
private hideWhitespaceInHistoryDiff: boolean =
hideWhitespaceInHistoryDiffDefault
+ private hideWhitespaceInPullRequestDiff: boolean =
+ hideWhitespaceInPullRequestDiffDefault
/** Whether or not the spellchecker is enabled for commit summary and description */
private commitSpellcheckEnabled: boolean = commitSpellcheckEnabledDefault
private showSideBySideDiff: boolean = ShowSideBySideDiffDefault
@@ -925,6 +929,7 @@ export class AppStore extends TypedBaseStore {
imageDiffType: this.imageDiffType,
hideWhitespaceInChangesDiff: this.hideWhitespaceInChangesDiff,
hideWhitespaceInHistoryDiff: this.hideWhitespaceInHistoryDiff,
+ hideWhitespaceInPullRequestDiff: this.hideWhitespaceInPullRequestDiff,
showSideBySideDiff: this.showSideBySideDiff,
selectedShell: this.selectedShell,
repositoryFilterText: this.repositoryFilterText,
@@ -2021,6 +2026,10 @@ export class AppStore extends TypedBaseStore {
hideWhitespaceInHistoryDiffKey,
false
)
+ this.hideWhitespaceInPullRequestDiff = getBoolean(
+ hideWhitespaceInPullRequestDiffKey,
+ false
+ )
this.commitSpellcheckEnabled = getBoolean(
commitSpellcheckEnabledKey,
commitSpellcheckEnabledDefault
@@ -5324,6 +5333,19 @@ export class AppStore extends TypedBaseStore {
}
}
+ public _setHideWhitespaceInPullRequestDiff(
+ hideWhitespaceInDiff: boolean,
+ repository: Repository,
+ file: CommittedFileChange | null
+ ) {
+ setBoolean(hideWhitespaceInPullRequestDiffKey, hideWhitespaceInDiff)
+ this.hideWhitespaceInPullRequestDiff = hideWhitespaceInDiff
+
+ if (file !== null) {
+ this._changePullRequestFileSelection(repository, file)
+ }
+ }
+
public _setShowSideBySideDiff(showSideBySideDiff: boolean) {
if (showSideBySideDiff !== this.showSideBySideDiff) {
setShowSideBySideDiff(showSideBySideDiff)
@@ -7305,7 +7327,7 @@ export class AppStore extends TypedBaseStore {
file,
baseBranch.name,
currentBranch.name,
- this.hideWhitespaceInHistoryDiff,
+ this.hideWhitespaceInPullRequestDiff,
commitSHAs[0]
)
)) ?? null
diff --git a/app/src/ui/app.tsx b/app/src/ui/app.tsx
index 4a6e1a1caa..8bb82c098a 100644
--- a/app/src/ui/app.tsx
+++ b/app/src/ui/app.tsx
@@ -2261,7 +2261,7 @@ export class App extends React.Component {
const {
pullRequestFilesListWidth,
- hideWhitespaceInHistoryDiff,
+ hideWhitespaceInPullRequestDiff,
showSideBySideDiff,
} = this.state
@@ -2284,7 +2284,7 @@ export class App extends React.Component {
defaultBranch={defaultBranch}
dispatcher={this.props.dispatcher}
fileListWidth={pullRequestFilesListWidth}
- hideWhitespaceInDiff={hideWhitespaceInHistoryDiff}
+ hideWhitespaceInDiff={hideWhitespaceInPullRequestDiff}
imageDiffType={imageDiffType}
nonLocalCommitSHA={nonLocalCommitSHA}
pullRequestState={pullRequestState}
diff --git a/app/src/ui/diff/diff-options.tsx b/app/src/ui/diff/diff-options.tsx
index f2ec38a893..f5791f5e44 100644
--- a/app/src/ui/diff/diff-options.tsx
+++ b/app/src/ui/diff/diff-options.tsx
@@ -10,7 +10,7 @@ interface IDiffOptionsProps {
readonly hideWhitespaceChanges: boolean
readonly onHideWhitespaceChangesChanged: (
hideWhitespaceChanges: boolean
- ) => Promise
+ ) => Promise | void
readonly showSideBySideDiff: boolean
readonly onShowSideBySideDiffChanged: (showSideBySideDiff: boolean) => void
diff --git a/app/src/ui/dispatcher/dispatcher.ts b/app/src/ui/dispatcher/dispatcher.ts
index d6ac77637e..dec5515def 100644
--- a/app/src/ui/dispatcher/dispatcher.ts
+++ b/app/src/ui/dispatcher/dispatcher.ts
@@ -2122,6 +2122,19 @@ export class Dispatcher {
)
}
+ /** Change the hide whitespace in pull request diff setting */
+ public onHideWhitespaceInPullRequestDiffChanged(
+ hideWhitespaceInDiff: boolean,
+ repository: Repository,
+ file: CommittedFileChange | null = null
+ ) {
+ this.appStore._setHideWhitespaceInPullRequestDiff(
+ hideWhitespaceInDiff,
+ repository,
+ file
+ )
+ }
+
/** Change the side by side diff setting */
public onShowSideBySideDiffChanged(showSideBySideDiff: boolean) {
return this.appStore._setShowSideBySideDiff(showSideBySideDiff)
diff --git a/app/src/ui/open-pull-request/pull-request-files-changed.tsx b/app/src/ui/open-pull-request/pull-request-files-changed.tsx
index 6a8921e261..d297240562 100644
--- a/app/src/ui/open-pull-request/pull-request-files-changed.tsx
+++ b/app/src/ui/open-pull-request/pull-request-files-changed.tsx
@@ -60,7 +60,7 @@ interface IPullRequestFilesChangedProps {
}
/**
- * A component for viewing the file diff for a pull request.
+ * A component for viewing the file changes for a pull request.
*/
export class PullRequestFilesChanged extends React.Component<
IPullRequestFilesChangedProps,
@@ -82,7 +82,7 @@ export class PullRequestFilesChanged extends React.Component<
/** Called when the user changes the hide whitespace in diffs setting. */
private onHideWhitespaceInDiffChanged = (hideWhitespaceInDiff: boolean) => {
const { selectedFile } = this.props
- return this.props.dispatcher.onHideWhitespaceInHistoryDiffChanged(
+ return this.props.dispatcher.onHideWhitespaceInPullRequestDiffChanged(
hideWhitespaceInDiff,
this.props.repository,
selectedFile as CommittedFileChange
From 785664c7e91b57d4f044ea1d9202500f6301297d Mon Sep 17 00:00:00 2001
From: tidy-dev <75402236+tidy-dev@users.noreply.github.com>
Date: Wed, 28 Sep 2022 08:03:04 -0400
Subject: [PATCH 034/262] Remove copy/pasta casting
---
app/src/ui/open-pull-request/pull-request-files-changed.tsx | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/app/src/ui/open-pull-request/pull-request-files-changed.tsx b/app/src/ui/open-pull-request/pull-request-files-changed.tsx
index d297240562..a41d6c9d31 100644
--- a/app/src/ui/open-pull-request/pull-request-files-changed.tsx
+++ b/app/src/ui/open-pull-request/pull-request-files-changed.tsx
@@ -85,7 +85,7 @@ export class PullRequestFilesChanged extends React.Component<
return this.props.dispatcher.onHideWhitespaceInPullRequestDiffChanged(
hideWhitespaceInDiff,
this.props.repository,
- selectedFile as CommittedFileChange
+ selectedFile
)
}
From 27caadcde931c1fd584c53c92f7668a351a55821 Mon Sep 17 00:00:00 2001
From: tidy-dev <75402236+tidy-dev@users.noreply.github.com>
Date: Wed, 28 Sep 2022 08:16:16 -0400
Subject: [PATCH 035/262] Move sideBySidediff state management to files changed
component
---
app/src/lib/stores/app-store.ts | 4 ++-
app/src/models/popup.ts | 1 +
app/src/ui/app.tsx | 8 +++---
.../pull-request-files-changed.tsx | 27 ++++++++++++-------
.../ui/_pull-request-files-changed.scss | 4 +++
5 files changed, 28 insertions(+), 16 deletions(-)
diff --git a/app/src/lib/stores/app-store.ts b/app/src/lib/stores/app-store.ts
index 970bcd9490..9674327244 100644
--- a/app/src/lib/stores/app-store.ts
+++ b/app/src/lib/stores/app-store.ts
@@ -7264,7 +7264,8 @@ export class AppStore extends TypedBaseStore {
}
const { allBranches, recentBranches } = branchesState
- const { imageDiffType, selectedExternalEditor } = this.getState()
+ const { imageDiffType, selectedExternalEditor, showSideBySideDiff } =
+ this.getState()
this._showPopup({
type: PopupType.StartPullRequest,
@@ -7279,6 +7280,7 @@ export class AppStore extends TypedBaseStore {
commitSHAs.length > 0 && !localCommitSHAs.includes(commitSHAs[0])
? commitSHAs[0]
: null,
+ showSideBySideDiff,
})
}
diff --git a/app/src/models/popup.ts b/app/src/models/popup.ts
index dfca4a6a28..57cc87c866 100644
--- a/app/src/models/popup.ts
+++ b/app/src/models/popup.ts
@@ -370,4 +370,5 @@ export type Popup =
recentBranches: ReadonlyArray
repository: Repository
nonLocalCommitSHA: string | null
+ showSideBySideDiff: boolean
}
diff --git a/app/src/ui/app.tsx b/app/src/ui/app.tsx
index 8bb82c098a..d6cd421e39 100644
--- a/app/src/ui/app.tsx
+++ b/app/src/ui/app.tsx
@@ -2259,11 +2259,8 @@ export class App extends React.Component {
return null
}
- const {
- pullRequestFilesListWidth,
- hideWhitespaceInPullRequestDiff,
- showSideBySideDiff,
- } = this.state
+ const { pullRequestFilesListWidth, hideWhitespaceInPullRequestDiff } =
+ this.state
const {
allBranches,
@@ -2274,6 +2271,7 @@ export class App extends React.Component {
nonLocalCommitSHA,
recentBranches,
repository,
+ showSideBySideDiff,
} = popup
return (
diff --git a/app/src/ui/open-pull-request/pull-request-files-changed.tsx b/app/src/ui/open-pull-request/pull-request-files-changed.tsx
index a41d6c9d31..e8ca091104 100644
--- a/app/src/ui/open-pull-request/pull-request-files-changed.tsx
+++ b/app/src/ui/open-pull-request/pull-request-files-changed.tsx
@@ -59,13 +59,23 @@ interface IPullRequestFilesChangedProps {
readonly nonLocalCommitSHA: string | null
}
+interface IPullRequestFilesChangedState {
+ readonly showSideBySideDiff: boolean
+}
+
/**
* A component for viewing the file changes for a pull request.
*/
export class PullRequestFilesChanged extends React.Component<
IPullRequestFilesChangedProps,
- {}
+ IPullRequestFilesChangedState
> {
+ public constructor(props: IPullRequestFilesChangedProps) {
+ super(props)
+
+ this.state = { showSideBySideDiff: props.showSideBySideDiff }
+ }
+
private onOpenFile = (path: string) => {
const fullPath = Path.join(this.props.repository.path, path)
this.onOpenBinaryFile(fullPath)
@@ -90,7 +100,7 @@ export class PullRequestFilesChanged extends React.Component<
}
private onShowSideBySideDiffChanged = (showSideBySideDiff: boolean) => {
- this.props.dispatcher.onShowSideBySideDiffChanged(showSideBySideDiff)
+ this.setState({ showSideBySideDiff })
}
private onDiffOptionsOpened = () => {
@@ -215,7 +225,8 @@ export class PullRequestFilesChanged extends React.Component<
}
private renderHeader() {
- const { hideWhitespaceInDiff, showSideBySideDiff } = this.props
+ const { hideWhitespaceInDiff } = this.props
+ const { showSideBySideDiff } = this.state
return (
@@ -262,13 +273,9 @@ export class PullRequestFilesChanged extends React.Component<
return
}
- const {
- diff,
- repository,
- imageDiffType,
- hideWhitespaceInDiff,
- showSideBySideDiff,
- } = this.props
+ const { diff, repository, imageDiffType, hideWhitespaceInDiff } = this.props
+
+ const { showSideBySideDiff } = this.state
return (
Date: Mon, 26 Sep 2022 13:01:55 -0400
Subject: [PATCH 036/262] Use MacOs/Windows Sentence casing
---
app/src/ui/open-pull-request/open-pull-request-dialog.tsx | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/app/src/ui/open-pull-request/open-pull-request-dialog.tsx b/app/src/ui/open-pull-request/open-pull-request-dialog.tsx
index c6991954b0..f55546f465 100644
--- a/app/src/ui/open-pull-request/open-pull-request-dialog.tsx
+++ b/app/src/ui/open-pull-request/open-pull-request-dialog.tsx
@@ -134,8 +134,9 @@ export class OpenPullRequestDialog extends React.Component
From f6a72527cc6cc8f550aa96bb6355a5d23b812b8c Mon Sep 17 00:00:00 2001
From: tidy-dev <75402236+tidy-dev@users.noreply.github.com>
Date: Mon, 26 Sep 2022 13:02:16 -0400
Subject: [PATCH 037/262] Add Enterprise label
---
.../ui/open-pull-request/open-pull-request-dialog.tsx | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/app/src/ui/open-pull-request/open-pull-request-dialog.tsx b/app/src/ui/open-pull-request/open-pull-request-dialog.tsx
index f55546f465..4627d438f7 100644
--- a/app/src/ui/open-pull-request/open-pull-request-dialog.tsx
+++ b/app/src/ui/open-pull-request/open-pull-request-dialog.tsx
@@ -1,5 +1,6 @@
import * as React from 'react'
import { IConstrainedValue, IPullRequestState } from '../../lib/app-state'
+import { getDotComAPIEndpoint } from '../../lib/api'
import { Branch } from '../../models/branch'
import { ImageDiffType } from '../../models/diff'
import { Repository } from '../../models/repository'
@@ -131,12 +132,20 @@ export class OpenPullRequestDialog extends React.Component
From cad3813389608fd11b53cbc2e13268fc94f2a57e Mon Sep 17 00:00:00 2001
From: tidy-dev <75402236+tidy-dev@users.noreply.github.com>
Date: Wed, 28 Sep 2022 08:41:50 -0400
Subject: [PATCH 038/262] Add no changes div
---
.../open-pull-request-dialog.tsx | 17 ++++++++++++++++-
.../pull-request-files-changed.tsx | 1 -
2 files changed, 16 insertions(+), 2 deletions(-)
diff --git a/app/src/ui/open-pull-request/open-pull-request-dialog.tsx b/app/src/ui/open-pull-request/open-pull-request-dialog.tsx
index c6991954b0..fe449d15a9 100644
--- a/app/src/ui/open-pull-request/open-pull-request-dialog.tsx
+++ b/app/src/ui/open-pull-request/open-pull-request-dialog.tsx
@@ -93,6 +93,7 @@ export class OpenPullRequestDialog extends React.Component
+ {this.renderNoChanges()}
{this.renderFilesChanged()}
)
@@ -110,9 +111,13 @@ export class OpenPullRequestDialog extends React.Component
No changes!
+ }
+
private renderFooter() {
return (
diff --git a/app/src/ui/open-pull-request/pull-request-files-changed.tsx b/app/src/ui/open-pull-request/pull-request-files-changed.tsx
index d08e9a30a9..02d02e48be 100644
--- a/app/src/ui/open-pull-request/pull-request-files-changed.tsx
+++ b/app/src/ui/open-pull-request/pull-request-files-changed.tsx
@@ -267,7 +267,6 @@ export class PullRequestFilesChanged extends React.Component<
}
public render() {
- // TODO: handle empty change set
return (
{this.renderHeader()}
From cec67105a1849417f8e788edb09717cdb02effe6 Mon Sep 17 00:00:00 2001
From: tidy-dev <75402236+tidy-dev@users.noreply.github.com>
Date: Wed, 28 Sep 2022 08:41:56 -0400
Subject: [PATCH 039/262] Center no changes content
---
app/styles/ui/dialogs/_open-pull-request.scss | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/app/styles/ui/dialogs/_open-pull-request.scss b/app/styles/ui/dialogs/_open-pull-request.scss
index 2c6f174137..6cdbb91e7f 100644
--- a/app/styles/ui/dialogs/_open-pull-request.scss
+++ b/app/styles/ui/dialogs/_open-pull-request.scss
@@ -22,4 +22,13 @@
.open-pull-request-content {
padding: var(--spacing);
}
+
+ .open-pull-request-no-changes {
+ height: 100%;
+ display: flex;
+ align-items: center;
+ text-align: center;
+ justify-content: center;
+ padding: var(--spacing-double);
+ }
}
From 9a3c29b5b8031ea7271d2b9d822cffd1471fe68d Mon Sep 17 00:00:00 2001
From: tidy-dev <75402236+tidy-dev@users.noreply.github.com>
Date: Wed, 28 Sep 2022 09:04:53 -0400
Subject: [PATCH 040/262] Add no changes verbiage
---
.../open-pull-request-dialog.tsx | 18 ++++++++++++++++--
1 file changed, 16 insertions(+), 2 deletions(-)
diff --git a/app/src/ui/open-pull-request/open-pull-request-dialog.tsx b/app/src/ui/open-pull-request/open-pull-request-dialog.tsx
index fe449d15a9..95fb620209 100644
--- a/app/src/ui/open-pull-request/open-pull-request-dialog.tsx
+++ b/app/src/ui/open-pull-request/open-pull-request-dialog.tsx
@@ -5,6 +5,9 @@ import { ImageDiffType } from '../../models/diff'
import { Repository } from '../../models/repository'
import { DialogFooter, OkCancelButtonGroup, Dialog } from '../dialog'
import { Dispatcher } from '../dispatcher'
+import { Ref } from '../lib/ref'
+import { Octicon } from '../octicons'
+import * as OcticonSymbol from '../octicons/octicons.generated'
import { OpenPullRequestDialogHeader } from './open-pull-request-header'
import { PullRequestFilesChanged } from './pull-request-files-changed'
@@ -136,13 +139,24 @@ export class OpenPullRequestDialog extends React.Component No changes!
+ return (
+
+
+
+
There are no changes.
+ [{baseBranch.name}] is up to date with all commits from{' '}
+ [{currentBranch.name}].
+
+
+ )
}
private renderFooter() {
From c9d74f4a775608b0042167176a879458d0e2d5e4 Mon Sep 17 00:00:00 2001
From: tidy-dev <75402236+tidy-dev@users.noreply.github.com>
Date: Thu, 29 Sep 2022 11:15:37 -0400
Subject: [PATCH 041/262] Update app/src/lib/stores/app-store.ts
Co-authored-by: Sergio Padrino
---
app/src/lib/stores/app-store.ts | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/app/src/lib/stores/app-store.ts b/app/src/lib/stores/app-store.ts
index 9674327244..008e6f27b9 100644
--- a/app/src/lib/stores/app-store.ts
+++ b/app/src/lib/stores/app-store.ts
@@ -352,7 +352,7 @@ const hideWhitespaceInChangesDiffKey = 'hide-whitespace-in-changes-diff'
const hideWhitespaceInHistoryDiffDefault = false
const hideWhitespaceInHistoryDiffKey = 'hide-whitespace-in-diff'
const hideWhitespaceInPullRequestDiffDefault = false
-const hideWhitespaceInPullRequestDiffKey = 'hide-whitespace-in-diff'
+const hideWhitespaceInPullRequestDiffKey = 'hide-whitespace-in-pull-request-diff'
const commitSpellcheckEnabledDefault = true
const commitSpellcheckEnabledKey = 'commit-spellcheck-enabled'
From 21d0a60c05152efbf05ec1cde7f656edc2479944 Mon Sep 17 00:00:00 2001
From: tidy-dev <75402236+tidy-dev@users.noreply.github.com>
Date: Thu, 29 Sep 2022 11:21:50 -0400
Subject: [PATCH 042/262] Don't need this to be a promise?
---
app/src/ui/diff/diff-options.tsx | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/app/src/ui/diff/diff-options.tsx b/app/src/ui/diff/diff-options.tsx
index f5791f5e44..9196dd9317 100644
--- a/app/src/ui/diff/diff-options.tsx
+++ b/app/src/ui/diff/diff-options.tsx
@@ -10,7 +10,7 @@ interface IDiffOptionsProps {
readonly hideWhitespaceChanges: boolean
readonly onHideWhitespaceChangesChanged: (
hideWhitespaceChanges: boolean
- ) => Promise | void
+ ) => void
readonly showSideBySideDiff: boolean
readonly onShowSideBySideDiffChanged: (showSideBySideDiff: boolean) => void
From 42cd43b6d96aaddf5b95d23adbdf44aaf6462b8d Mon Sep 17 00:00:00 2001
From: tidy-dev <75402236+tidy-dev@users.noreply.github.com>
Date: Thu, 29 Sep 2022 11:25:45 -0400
Subject: [PATCH 043/262] Linter..
---
app/src/lib/stores/app-store.ts | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/app/src/lib/stores/app-store.ts b/app/src/lib/stores/app-store.ts
index 008e6f27b9..a38313233c 100644
--- a/app/src/lib/stores/app-store.ts
+++ b/app/src/lib/stores/app-store.ts
@@ -352,7 +352,8 @@ const hideWhitespaceInChangesDiffKey = 'hide-whitespace-in-changes-diff'
const hideWhitespaceInHistoryDiffDefault = false
const hideWhitespaceInHistoryDiffKey = 'hide-whitespace-in-diff'
const hideWhitespaceInPullRequestDiffDefault = false
-const hideWhitespaceInPullRequestDiffKey = 'hide-whitespace-in-pull-request-diff'
+const hideWhitespaceInPullRequestDiffKey =
+ 'hide-whitespace-in-pull-request-diff'
const commitSpellcheckEnabledDefault = true
const commitSpellcheckEnabledKey = 'commit-spellcheck-enabled'
From cc69b05956d100aff772051e945f98657f71f0b5 Mon Sep 17 00:00:00 2001
From: tidy-dev <75402236+tidy-dev@users.noreply.github.com>
Date: Mon, 26 Sep 2022 11:25:24 -0400
Subject: [PATCH 044/262] Add update method chain to app-store
---
app/src/lib/stores/app-store.ts | 1 +
app/src/ui/dispatcher/dispatcher.ts | 4 ++++
app/src/ui/open-pull-request/open-pull-request-dialog.tsx | 6 ++++++
app/src/ui/open-pull-request/open-pull-request-header.tsx | 5 +++++
4 files changed, 16 insertions(+)
diff --git a/app/src/lib/stores/app-store.ts b/app/src/lib/stores/app-store.ts
index a38313233c..caec31e2d3 100644
--- a/app/src/lib/stores/app-store.ts
+++ b/app/src/lib/stores/app-store.ts
@@ -7377,6 +7377,7 @@ export class AppStore extends TypedBaseStore {
return Promise.resolve()
}
+ public _updatePullRequestBaseBranch(repository: Repository, branch: Branch) {}
}
/**
diff --git a/app/src/ui/dispatcher/dispatcher.ts b/app/src/ui/dispatcher/dispatcher.ts
index dec5515def..2641f3cfc1 100644
--- a/app/src/ui/dispatcher/dispatcher.ts
+++ b/app/src/ui/dispatcher/dispatcher.ts
@@ -4001,4 +4001,8 @@ export class Dispatcher {
public resetPullRequestFileListWidth(): Promise {
return this.appStore._resetPullRequestFileListWidth()
}
+
+ public updatePullRequestBaseBranch(repository: Repository, branch: Branch) {
+ this.appStore._updatePullRequestBaseBranch(repository, branch)
+ }
}
diff --git a/app/src/ui/open-pull-request/open-pull-request-dialog.tsx b/app/src/ui/open-pull-request/open-pull-request-dialog.tsx
index c6991954b0..53ffd5fcf5 100644
--- a/app/src/ui/open-pull-request/open-pull-request-dialog.tsx
+++ b/app/src/ui/open-pull-request/open-pull-request-dialog.tsx
@@ -68,6 +68,11 @@ export class OpenPullRequestDialog extends React.Component {
+ const { repository } = this.props
+ this.props.dispatcher.updatePullRequestBaseBranch(repository, branch)
+ }
+
private renderHeader() {
const {
currentBranch,
@@ -85,6 +90,7 @@ export class OpenPullRequestDialog extends React.Component
)
diff --git a/app/src/ui/open-pull-request/open-pull-request-header.tsx b/app/src/ui/open-pull-request/open-pull-request-header.tsx
index e6b6045308..b9e376387b 100644
--- a/app/src/ui/open-pull-request/open-pull-request-header.tsx
+++ b/app/src/ui/open-pull-request/open-pull-request-header.tsx
@@ -30,6 +30,9 @@ interface IOpenPullRequestDialogHeaderProps {
/** The count of commits of the pull request */
readonly commitCount: number
+ /** When the branch selection changes */
+ readonly onBranchChange: (branch: Branch) => void
+
/**
* Event triggered when the dialog is dismissed by the user in the
* ways described in the dismissable prop.
@@ -54,6 +57,7 @@ export class OpenPullRequestDialogHeader extends React.Component<
allBranches,
recentBranches,
commitCount,
+ onBranchChange,
onDismissed,
} = this.props
const commits = `${commitCount} commit${commitCount > 1 ? 's' : ''}`
@@ -74,6 +78,7 @@ export class OpenPullRequestDialogHeader extends React.Component<
currentBranch={currentBranch}
allBranches={allBranches}
recentBranches={recentBranches}
+ onChange={onBranchChange}
/>{' '}
from [{currentBranch.name}].
From c4d549387635072b0cb1d0bee2f067415f77f833 Mon Sep 17 00:00:00 2001
From: tidy-dev <75402236+tidy-dev@users.noreply.github.com>
Date: Mon, 26 Sep 2022 12:48:29 -0400
Subject: [PATCH 045/262] Repeat pr start for new base branch (
move duplicate logic to new method)
---
app/src/lib/stores/app-store.ts | 39 ++++++++++++++++++++++++++++-----
1 file changed, 34 insertions(+), 5 deletions(-)
diff --git a/app/src/lib/stores/app-store.ts b/app/src/lib/stores/app-store.ts
index caec31e2d3..5ab929bc3d 100644
--- a/app/src/lib/stores/app-store.ts
+++ b/app/src/lib/stores/app-store.ts
@@ -7215,12 +7215,19 @@ export class AppStore extends TypedBaseStore {
if (defaultBranch === null || tip.kind !== TipState.Valid) {
return
}
-
const currentBranch = tip.branch
+ this._initializePullRequestPreview(repository, defaultBranch, currentBranch)
+ }
+
+ private async _initializePullRequestPreview(
+ repository: Repository,
+ baseBranch: Branch,
+ currentBranch: Branch
+ ) {
const gitStore = this.gitStoreCache.get(repository)
const pullRequestCommits = await gitStore.getCommitsBetweenBranches(
- defaultBranch,
+ baseBranch,
currentBranch
)
@@ -7233,7 +7240,7 @@ export class AppStore extends TypedBaseStore {
? await gitStore.performFailableOperation(() =>
getBranchMergeBaseChangedFiles(
repository,
- defaultBranch.name,
+ baseBranch.name,
currentBranch.name,
commitSHAs[0]
)
@@ -7245,7 +7252,7 @@ export class AppStore extends TypedBaseStore {
}
this.repositoryStateCache.initializePullRequestState(repository, {
- baseBranch: defaultBranch,
+ baseBranch,
commitSHAs,
commitSelection: {
shas: commitSHAs,
@@ -7257,6 +7264,8 @@ export class AppStore extends TypedBaseStore {
},
})
+ this.emitUpdate()
+
if (changesetData.files.length > 0) {
await this._changePullRequestFileSelection(
repository,
@@ -7377,7 +7386,27 @@ export class AppStore extends TypedBaseStore {
return Promise.resolve()
}
- public _updatePullRequestBaseBranch(repository: Repository, branch: Branch) {}
+
+ public _updatePullRequestBaseBranch(
+ repository: Repository,
+ baseBranch: Branch
+ ) {
+ const { branchesState, pullRequestState } =
+ this.repositoryStateCache.get(repository)
+ const { tip } = branchesState
+
+ if (tip.kind !== TipState.Valid) {
+ return
+ }
+
+ if (pullRequestState === null) {
+ // This would mean the user submitted PR after requesting base branch
+ // update.
+ return
+ }
+
+ this._initializePullRequestPreview(repository, baseBranch, tip.branch)
+ }
}
/**
From bf9e2422e719f5b2b77a280a87df5bb02586dbb7 Mon Sep 17 00:00:00 2001
From: tidy-dev <75402236+tidy-dev@users.noreply.github.com>
Date: Thu, 29 Sep 2022 10:40:07 -0400
Subject: [PATCH 046/262] Fix update from dev changes
---
app/src/lib/stores/app-store.ts | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/app/src/lib/stores/app-store.ts b/app/src/lib/stores/app-store.ts
index 5ab929bc3d..7dea0b780d 100644
--- a/app/src/lib/stores/app-store.ts
+++ b/app/src/lib/stores/app-store.ts
@@ -7208,8 +7208,7 @@ export class AppStore extends TypedBaseStore {
}
public async _startPullRequest(repository: Repository) {
- const { branchesState, localCommitSHAs } =
- this.repositoryStateCache.get(repository)
+ const { branchesState } = this.repositoryStateCache.get(repository)
const { defaultBranch, tip } = branchesState
if (defaultBranch === null || tip.kind !== TipState.Valid) {
@@ -7224,6 +7223,8 @@ export class AppStore extends TypedBaseStore {
baseBranch: Branch,
currentBranch: Branch
) {
+ const { branchesState, localCommitSHAs } =
+ this.repositoryStateCache.get(repository)
const gitStore = this.gitStoreCache.get(repository)
const pullRequestCommits = await gitStore.getCommitsBetweenBranches(
@@ -7273,7 +7274,7 @@ export class AppStore extends TypedBaseStore {
)
}
- const { allBranches, recentBranches } = branchesState
+ const { allBranches, recentBranches, defaultBranch } = branchesState
const { imageDiffType, selectedExternalEditor, showSideBySideDiff } =
this.getState()
From 1b76c6fc8c93e1dd026b6abbbd5d3cd9aa827238 Mon Sep 17 00:00:00 2001
From: Rebecca Miller-Webster
Date: Thu, 29 Sep 2022 15:52:37 -0500
Subject: [PATCH 047/262] Update setup.md
Update expected node, yarn, and python versions
---
docs/contributing/setup.md | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/docs/contributing/setup.md b/docs/contributing/setup.md
index 2b1f3d7020..05a6819e98 100644
--- a/docs/contributing/setup.md
+++ b/docs/contributing/setup.md
@@ -19,13 +19,13 @@ versions look similar to the below output:
```shellsession
$ node -v
-v10.15.4
+v16.13.0
$ yarn -v
-1.15.2
+1.21.1
$ python --version
-Python 2.7.15
+Python 3.9.x
```
There are also [additional resources](tooling.md) to configure your favorite
From f18ce24e9695a99d34ee68dee93a1d233b182dde Mon Sep 17 00:00:00 2001
From: Tsvetilian Yankov
Date: Fri, 30 Sep 2022 12:49:38 +0300
Subject: [PATCH 048/262] Add discard stash toggle option to the prompt
---
app/src/ui/app.tsx | 3 +++
app/src/ui/stashing/confirm-discard-stash.tsx | 24 +++++++++++++++++++
2 files changed, 27 insertions(+)
diff --git a/app/src/ui/app.tsx b/app/src/ui/app.tsx
index 6609225ced..306899a670 100644
--- a/app/src/ui/app.tsx
+++ b/app/src/ui/app.tsx
@@ -1850,6 +1850,9 @@ export class App extends React.Component {
void
}
interface IConfirmDiscardStashState {
readonly isDiscarding: boolean
+ readonly confirmDiscardStash: boolean
}
/**
* Dialog to confirm dropping a stash
@@ -28,6 +31,7 @@ export class ConfirmDiscardStashDialog extends React.Component<
this.state = {
isDiscarding: false,
+ confirmDiscardStash: props.askForConfirmationOnDiscardStash,
}
}
@@ -46,6 +50,17 @@ export class ConfirmDiscardStashDialog extends React.Component<
>
Are you sure you want to discard these stashed changes?
+
+
+
@@ -54,6 +69,14 @@ export class ConfirmDiscardStashDialog extends React.Component<
)
}
+ private onAskForConfirmationOnDiscardStashChanged = (
+ event: React.FormEvent
+ ) => {
+ const value = !event.currentTarget.checked
+
+ this.setState({ confirmDiscardStash: value })
+ }
+
private onSubmit = async () => {
const { dispatcher, repository, stash, onDismissed } = this.props
@@ -62,6 +85,7 @@ export class ConfirmDiscardStashDialog extends React.Component<
})
try {
+ dispatcher.setConfirmDiscardStashSetting(this.state.confirmDiscardStash)
await dispatcher.dropStash(repository, stash)
} finally {
this.setState({
From 29c161d077a036d458efc9679d7449c7e11adfed Mon Sep 17 00:00:00 2001
From: Sergio Padrino
Date: Fri, 30 Sep 2022 18:03:52 +0200
Subject: [PATCH 049/262] Use a more accurate method name
---
app/src/main-process/app-window.ts | 2 +-
app/src/main-process/main.ts | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/app/src/main-process/app-window.ts b/app/src/main-process/app-window.ts
index 073509acac..96d2855c23 100644
--- a/app/src/main-process/app-window.ts
+++ b/app/src/main-process/app-window.ts
@@ -213,7 +213,7 @@ export class AppWindow {
return !!this.loadTime && !!this.rendererReadyTime
}
- public onClose(fn: () => void) {
+ public onClosed(fn: () => void) {
this.window.on('closed', fn)
}
diff --git a/app/src/main-process/main.ts b/app/src/main-process/main.ts
index 114480145f..6107895ca5 100644
--- a/app/src/main-process/main.ts
+++ b/app/src/main-process/main.ts
@@ -738,7 +738,7 @@ function createWindow() {
}
}
- window.onClose(() => {
+ window.onClosed(() => {
mainWindow = null
if (!__DARWIN__ && !preventQuit) {
app.quit()
From 8b1c2dee62a8dc31d7d50c9033937cbaab79ff8c Mon Sep 17 00:00:00 2001
From: Sergio Padrino
Date: Fri, 30 Sep 2022 18:04:42 +0200
Subject: [PATCH 050/262] First steps of an "installing update" dialog
---
app/src/lib/ipc-shared.ts | 1 +
app/src/lib/stores/app-store.ts | 9 ++
app/src/models/popup.ts | 4 +
app/src/ui/app.tsx | 9 ++
.../installing-update/installing-update.tsx | 140 ++++++++++++++++++
app/src/ui/main-process-proxy.ts | 6 +
6 files changed, 169 insertions(+)
create mode 100644 app/src/ui/installing-update/installing-update.tsx
diff --git a/app/src/lib/ipc-shared.ts b/app/src/lib/ipc-shared.ts
index 07ffdb7cc0..dae329f719 100644
--- a/app/src/lib/ipc-shared.ts
+++ b/app/src/lib/ipc-shared.ts
@@ -77,6 +77,7 @@ export type RequestChannels = {
'focus-window': () => void
'notification-event': NotificationCallback
'set-window-zoom-factor': (zoomFactor: number) => void
+ 'show-installing-update': () => void
}
/**
diff --git a/app/src/lib/stores/app-store.ts b/app/src/lib/stores/app-store.ts
index a38313233c..6856656c89 100644
--- a/app/src/lib/stores/app-store.ts
+++ b/app/src/lib/stores/app-store.ts
@@ -77,6 +77,7 @@ import {
updatePreferredAppMenuItemLabels,
updateAccounts,
setWindowZoomFactor,
+ onShowInstallingUpdate,
} from '../../ui/main-process-proxy'
import {
API,
@@ -579,6 +580,8 @@ export class AppStore extends TypedBaseStore {
this.notificationsStore.onPullRequestReviewSubmitNotification(
this.onPullRequestReviewSubmitNotification
)
+
+ onShowInstallingUpdate(this.onShowInstallingUpdate)
}
private initializeWindowState = async () => {
@@ -649,6 +652,12 @@ export class AppStore extends TypedBaseStore {
})
}
+ private onShowInstallingUpdate = () => {
+ this._showPopup({
+ type: PopupType.InstallingUpdate,
+ })
+ }
+
/** Figure out what step of the tutorial the user needs to do next */
private async updateCurrentTutorialStep(
repository: Repository
diff --git a/app/src/models/popup.ts b/app/src/models/popup.ts
index 57cc87c866..fe2f1df53f 100644
--- a/app/src/models/popup.ts
+++ b/app/src/models/popup.ts
@@ -87,6 +87,7 @@ export enum PopupType {
PullRequestReview,
UnreachableCommits,
StartPullRequest,
+ InstallingUpdate,
}
export type Popup =
@@ -372,3 +373,6 @@ export type Popup =
nonLocalCommitSHA: string | null
showSideBySideDiff: boolean
}
+ | {
+ type: PopupType.InstallingUpdate
+ }
diff --git a/app/src/ui/app.tsx b/app/src/ui/app.tsx
index d6cd421e39..8adb22fd01 100644
--- a/app/src/ui/app.tsx
+++ b/app/src/ui/app.tsx
@@ -159,6 +159,7 @@ import { UnreachableCommitsDialog } from './history/unreachable-commits-dialog'
import { OpenPullRequestDialog } from './open-pull-request/open-pull-request-dialog'
import { sendNonFatalException } from '../lib/helpers/non-fatal-exception'
import { createCommitURL } from '../lib/commit-url'
+import { InstallingUpdate } from './installing-update/installing-update'
const MinuteInMilliseconds = 1000 * 60
const HourInMilliseconds = MinuteInMilliseconds * 60
@@ -2294,6 +2295,14 @@ export class App extends React.Component {
/>
)
}
+ case PopupType.InstallingUpdate: {
+ return (
+
+ )
+ }
default:
return assertNever(popup, `Unknown popup type: ${popup}`)
}
diff --git a/app/src/ui/installing-update/installing-update.tsx b/app/src/ui/installing-update/installing-update.tsx
new file mode 100644
index 0000000000..57e2cb9fc4
--- /dev/null
+++ b/app/src/ui/installing-update/installing-update.tsx
@@ -0,0 +1,140 @@
+import * as React from 'react'
+
+import { Row } from '../lib/row'
+import {
+ Dialog,
+ DialogContent,
+ OkCancelButtonGroup,
+ DialogFooter,
+} from '../dialog'
+import { updateStore, IUpdateState, UpdateStatus } from '../lib/update-store'
+import { Disposable } from 'event-kit'
+import { Loading } from '../lib/loading'
+import { assertNever } from '../../lib/fatal-error'
+import { closeWindow, sendWillQuitSync } from '../main-process-proxy'
+import { DialogHeader } from '../dialog/header'
+
+interface IInstallingUpdateProps {
+ /**
+ * Event triggered when the dialog is dismissed by the user in the
+ * ways described in the Dialog component's dismissable prop.
+ */
+ readonly onDismissed: () => void
+}
+
+interface IInstallingUpdateState {
+ readonly updateState: IUpdateState
+}
+
+/**
+ * A dialog that presents information about the
+ * running application such as name and version.
+ */
+export class InstallingUpdate extends React.Component<
+ IInstallingUpdateProps,
+ IInstallingUpdateState
+> {
+ private updateStoreEventHandle: Disposable | null = null
+
+ public constructor(props: IInstallingUpdateProps) {
+ super(props)
+
+ this.state = {
+ updateState: updateStore.state,
+ }
+ }
+
+ private onUpdateStateChanged = (updateState: IUpdateState) => {
+ this.setState({ updateState })
+
+ // If the update is not being downloaded (`UpdateStatus.UpdateAvailable`),
+ // i.e. if it's already downloaded or not available, close the window.
+ closeWindow()
+ if (updateState.status !== UpdateStatus.UpdateAvailable) {
+ }
+ }
+
+ public componentDidMount() {
+ this.updateStoreEventHandle = updateStore.onDidChange(
+ this.onUpdateStateChanged
+ )
+
+ // Manually update the state to ensure we're in sync with the store
+ this.onUpdateStateChanged(updateStore.state)
+ }
+
+ public componentWillUnmount() {
+ if (this.updateStoreEventHandle) {
+ this.updateStoreEventHandle.dispose()
+ this.updateStoreEventHandle = null
+ }
+ }
+
+ private renderUpdateAvailable() {
+ return (
+
+
+
+ Installing update… please, do not close GitHub Desktop until the
+ update is completely installed.
+
+
+ )
+ }
+
+ private renderUpdateReady() {
+ return (
+
+ An update has been downloaded, you can close GitHub Desktop now.
+
+ )
+ }
+
+ private renderUpdateDetails() {
+ const updateState = this.state.updateState
+
+ switch (updateState.status) {
+ case UpdateStatus.UpdateAvailable:
+ return this.renderUpdateAvailable()
+ case UpdateStatus.UpdateReady:
+ return this.renderUpdateReady()
+ case UpdateStatus.CheckingForUpdates:
+ case UpdateStatus.UpdateNotAvailable:
+ case UpdateStatus.UpdateNotChecked:
+ return null
+ default:
+ return assertNever(
+ updateState.status,
+ `Unknown update status ${updateState.status}`
+ )
+ }
+ }
+
+ private onQuitAnywayButtonClicked = () => {
+ sendWillQuitSync()
+ closeWindow()
+ }
+
+ public render() {
+ return (
+
+
+ {this.renderUpdateDetails()}
+
+
+
+
+ )
+ }
+}
diff --git a/app/src/ui/main-process-proxy.ts b/app/src/ui/main-process-proxy.ts
index 710c04378c..5ebbf7442a 100644
--- a/app/src/ui/main-process-proxy.ts
+++ b/app/src/ui/main-process-proxy.ts
@@ -200,6 +200,12 @@ export function onNativeThemeUpdated(eventHandler: () => void) {
ipcRenderer.on('native-theme-updated', eventHandler)
}
+/** Subscribes to the "show installing update dialog" event originating from the
+ * main process */
+export function onShowInstallingUpdate(eventHandler: () => void) {
+ ipcRenderer.on('show-installing-update', eventHandler)
+}
+
/** Tell the main process to set the native theme source */
export const setNativeThemeSource = sendProxy('set-native-theme-source', 1)
From 841ea8194b322b4de497e1d8e3a12308d4d0842c Mon Sep 17 00:00:00 2001
From: Sergio Padrino
Date: Fri, 30 Sep 2022 18:16:09 +0200
Subject: [PATCH 051/262] Attempting to quit the app
---
app/src/lib/ipc-shared.ts | 1 +
app/src/main-process/app-window.ts | 22 +++++++++++++++++++
.../installing-update/installing-update.tsx | 14 +++++++++---
app/src/ui/lib/update-store.ts | 2 +-
app/src/ui/main-process-proxy.ts | 12 ++++++++++
5 files changed, 47 insertions(+), 4 deletions(-)
diff --git a/app/src/lib/ipc-shared.ts b/app/src/lib/ipc-shared.ts
index dae329f719..aa84deb7ab 100644
--- a/app/src/lib/ipc-shared.ts
+++ b/app/src/lib/ipc-shared.ts
@@ -46,6 +46,7 @@ export type RequestChannels = {
'menu-event': (name: MenuEvent) => void
log: (level: LogLevel, message: string) => void
'will-quit': () => void
+ 'will-quit-even-updating': () => void
'crash-ready': () => void
'crash-quit': () => void
'window-state-changed': (windowState: WindowState) => void
diff --git a/app/src/main-process/app-window.ts b/app/src/main-process/app-window.ts
index 96d2855c23..84a1ffd880 100644
--- a/app/src/main-process/app-window.ts
+++ b/app/src/main-process/app-window.ts
@@ -33,6 +33,7 @@ export class AppWindow {
private _loadTime: number | null = null
private _rendererReadyTime: number | null = null
+ private isDownloadingUpdate: boolean = false
private minWidth = 960
private minHeight = 660
@@ -86,6 +87,7 @@ export class AppWindow {
this.shouldMaximizeOnShow = savedWindowState.isMaximized
let quitting = false
+ let quittingEvenDownloadingUpdate = false
app.on('before-quit', () => {
quitting = true
})
@@ -95,7 +97,22 @@ export class AppWindow {
event.returnValue = true
})
+ ipcMain.on('will-quit-even-updating', event => {
+ quitting = true
+ quittingEvenDownloadingUpdate = true
+ event.returnValue = true
+ })
+
this.window.on('close', e => {
+ if (
+ !quittingEvenDownloadingUpdate &&
+ (1 !== NaN || this.isDownloadingUpdate)
+ ) {
+ e.preventDefault()
+ ipcWebContents.send(this.window.webContents, 'show-installing-update')
+ return
+ }
+
// on macOS, when the user closes the window we really just hide it. This
// lets us activate quickly and keep all our interesting logic in the
// renderer.
@@ -344,10 +361,12 @@ export class AppWindow {
public setupAutoUpdater() {
autoUpdater.on('error', (error: Error) => {
+ this.isDownloadingUpdate = false
ipcWebContents.send(this.window.webContents, 'auto-updater-error', error)
})
autoUpdater.on('checking-for-update', () => {
+ this.isDownloadingUpdate = false
ipcWebContents.send(
this.window.webContents,
'auto-updater-checking-for-update'
@@ -355,6 +374,7 @@ export class AppWindow {
})
autoUpdater.on('update-available', () => {
+ this.isDownloadingUpdate = true
ipcWebContents.send(
this.window.webContents,
'auto-updater-update-available'
@@ -362,6 +382,7 @@ export class AppWindow {
})
autoUpdater.on('update-not-available', () => {
+ this.isDownloadingUpdate = false
ipcWebContents.send(
this.window.webContents,
'auto-updater-update-not-available'
@@ -369,6 +390,7 @@ export class AppWindow {
})
autoUpdater.on('update-downloaded', () => {
+ this.isDownloadingUpdate = false
ipcWebContents.send(
this.window.webContents,
'auto-updater-update-downloaded'
diff --git a/app/src/ui/installing-update/installing-update.tsx b/app/src/ui/installing-update/installing-update.tsx
index 57e2cb9fc4..4e1158252c 100644
--- a/app/src/ui/installing-update/installing-update.tsx
+++ b/app/src/ui/installing-update/installing-update.tsx
@@ -11,8 +11,13 @@ import { updateStore, IUpdateState, UpdateStatus } from '../lib/update-store'
import { Disposable } from 'event-kit'
import { Loading } from '../lib/loading'
import { assertNever } from '../../lib/fatal-error'
-import { closeWindow, sendWillQuitSync } from '../main-process-proxy'
+import {
+ closeWindow,
+ sendWillQuitEvenUpdatingSync,
+ sendWillQuitSync,
+} from '../main-process-proxy'
import { DialogHeader } from '../dialog/header'
+import { app } from 'electron'
interface IInstallingUpdateProps {
/**
@@ -49,8 +54,10 @@ export class InstallingUpdate extends React.Component<
// If the update is not being downloaded (`UpdateStatus.UpdateAvailable`),
// i.e. if it's already downloaded or not available, close the window.
- closeWindow()
if (updateState.status !== UpdateStatus.UpdateAvailable) {
+ sendWillQuitSync()
+ closeWindow()
+ app.quit()
}
}
@@ -111,8 +118,9 @@ export class InstallingUpdate extends React.Component<
}
private onQuitAnywayButtonClicked = () => {
- sendWillQuitSync()
+ sendWillQuitEvenUpdatingSync()
closeWindow()
+ app.quit()
}
public render() {
diff --git a/app/src/ui/lib/update-store.ts b/app/src/ui/lib/update-store.ts
index e4ad40d9ae..00e8c71c62 100644
--- a/app/src/ui/lib/update-store.ts
+++ b/app/src/ui/lib/update-store.ts
@@ -56,7 +56,7 @@ export interface IUpdateState {
/** A store which contains the current state of the auto updater. */
class UpdateStore {
private emitter = new Emitter()
- private status = UpdateStatus.UpdateNotChecked
+ private status = UpdateStatus.UpdateAvailable // UpdateStatus.UpdateNotChecked
private lastSuccessfulCheck: Date | null = null
private newReleases: ReadonlyArray | null = null
private isX64ToARM64ImmediateAutoUpdate: boolean = false
diff --git a/app/src/ui/main-process-proxy.ts b/app/src/ui/main-process-proxy.ts
index 5ebbf7442a..270ddfc8b9 100644
--- a/app/src/ui/main-process-proxy.ts
+++ b/app/src/ui/main-process-proxy.ts
@@ -279,6 +279,18 @@ export function sendWillQuitSync() {
ipcRenderer.sendSync('will-quit')
}
+/**
+ * Tell the main process that we're going to quit, even if the app is installing
+ * an update. This means it should allow the window to close.
+ *
+ * This event is sent synchronously to avoid any races with subsequent calls
+ * that would tell the app to quit.
+ */
+export function sendWillQuitEvenUpdatingSync() {
+ // eslint-disable-next-line no-sync
+ ipcRenderer.sendSync('will-quit-even-updating')
+}
+
/**
* Tell the main process to move the application to the application folder
*/
From 73fcceb2f42136f89b0e009a875ae966901d2415 Mon Sep 17 00:00:00 2001
From: Sathvik Shanmugam
Date: Sun, 2 Oct 2022 16:05:37 +0530
Subject: [PATCH 052/262] Adding new levels in zooming
---
app/src/main-process/menu/build-default-menu.ts | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/app/src/main-process/menu/build-default-menu.ts b/app/src/main-process/menu/build-default-menu.ts
index b01d63f30c..2186d80500 100644
--- a/app/src/main-process/menu/build-default-menu.ts
+++ b/app/src/main-process/menu/build-default-menu.ts
@@ -640,7 +640,7 @@ function emit(name: MenuEvent): ClickHandler {
}
/** The zoom steps that we support, these factors must sorted */
-const ZoomInFactors = [1, 1.1, 1.25, 1.5, 1.75, 2]
+const ZoomInFactors = [0.5, 0.75, 0.9, 1, 1.1, 1.25, 1.5, 1.75, 2]
const ZoomOutFactors = ZoomInFactors.slice().reverse()
/**
From 6ad7ec70b8b9ee42f10ee3a07d03a3bf4f07342e Mon Sep 17 00:00:00 2001
From: Sathvik Shanmugam
Date: Sun, 2 Oct 2022 16:44:40 +0530
Subject: [PATCH 053/262] Adding levels to get sync with the browser standards
---
app/src/main-process/menu/build-default-menu.ts | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/app/src/main-process/menu/build-default-menu.ts b/app/src/main-process/menu/build-default-menu.ts
index 2186d80500..a661eaa78a 100644
--- a/app/src/main-process/menu/build-default-menu.ts
+++ b/app/src/main-process/menu/build-default-menu.ts
@@ -640,7 +640,7 @@ function emit(name: MenuEvent): ClickHandler {
}
/** The zoom steps that we support, these factors must sorted */
-const ZoomInFactors = [0.5, 0.75, 0.9, 1, 1.1, 1.25, 1.5, 1.75, 2]
+const ZoomInFactors = [0.25, 0.33, 0.5, 0.67, 0.75, 0.8, 0.9, 1, 1.1, 1.25, 1.5, 1.75, 2]
const ZoomOutFactors = ZoomInFactors.slice().reverse()
/**
From 55f994e7f3ed92cd1a90d17b62c2f0894f8f9fe2 Mon Sep 17 00:00:00 2001
From: tidy-dev <75402236+tidy-dev@users.noreply.github.com>
Date: Mon, 3 Oct 2022 07:46:04 -0400
Subject: [PATCH 054/262] Make look like a button - add label
---
app/src/ui/branches/branch-select.tsx | 40 +++++++++++++--------------
app/src/ui/lib/popover-dropdown.tsx | 4 ++-
app/styles/ui/_branch-select.scss | 9 ------
app/styles/ui/_popover-dropdown.scss | 23 +++------------
4 files changed, 26 insertions(+), 50 deletions(-)
diff --git a/app/src/ui/branches/branch-select.tsx b/app/src/ui/branches/branch-select.tsx
index 4cde775e46..e79b5c6742 100644
--- a/app/src/ui/branches/branch-select.tsx
+++ b/app/src/ui/branches/branch-select.tsx
@@ -80,27 +80,25 @@ export class BranchSelect extends React.Component<
const { filterText, selectedBranch } = this.state
return (
-
+
+
+
)
}
}
diff --git a/app/src/ui/lib/popover-dropdown.tsx b/app/src/ui/lib/popover-dropdown.tsx
index d2e18518d1..7ba6233617 100644
--- a/app/src/ui/lib/popover-dropdown.tsx
+++ b/app/src/ui/lib/popover-dropdown.tsx
@@ -12,6 +12,7 @@ interface IPopoverDropdownProps {
readonly className?: string
readonly contentTitle: string
readonly buttonContent: JSX.Element | string
+ readonly label: string
}
interface IPopoverDropdownState {
@@ -112,7 +113,7 @@ export class PopoverDropdown extends React.Component<
}
public render() {
- const { className, buttonContent } = this.props
+ const { className, buttonContent, label } = this.props
const cn = classNames('popover-dropdown-component', className)
return (
@@ -121,6 +122,7 @@ export class PopoverDropdown extends React.Component<
onClick={this.togglePopover}
onButtonRef={this.onInvokeButtonRef}
>
+ {label}
{buttonContent}
diff --git a/app/styles/ui/_branch-select.scss b/app/styles/ui/_branch-select.scss
index c0ae93fd27..e69de29bb2 100644
--- a/app/styles/ui/_branch-select.scss
+++ b/app/styles/ui/_branch-select.scss
@@ -1,9 +0,0 @@
-.branch-select-component {
- display: inline;
-
- .base-label {
- font-weight: var(--font-weight-semibold);
- color: var(--text-secondary-color);
- margin: 0 var(--spacing-half);
- }
-}
diff --git a/app/styles/ui/_popover-dropdown.scss b/app/styles/ui/_popover-dropdown.scss
index 178674cb77..6a0ccdba23 100644
--- a/app/styles/ui/_popover-dropdown.scss
+++ b/app/styles/ui/_popover-dropdown.scss
@@ -1,25 +1,10 @@
.popover-dropdown-component {
display: inline-flex;
- button {
- border: none;
- background-color: inherit;
- border: none;
- padding: 0;
- margin: 0;
- color: var(--link-button-color);
- font-weight: bold;
- text-decoration: underline;
-
- &.button-component {
- overflow: visible;
-
- &:hover,
- &:focus {
- border: none;
- box-shadow: none;
- }
- }
+ .popover-dropdown-button-label {
+ font-weight: var(--font-weight-semibold);
+ color: var(--text-secondary-color);
+ margin: 0 var(--spacing-half);
}
.popover-dropdown-popover {
From 3ea43eb5a6ea8428d2a06100d4110e31b3c6c621 Mon Sep 17 00:00:00 2001
From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com>
Date: Mon, 3 Oct 2022 15:28:11 +0000
Subject: [PATCH 055/262] Bump peter-evans/create-pull-request from 4.1.2 to
4.1.3
Bumps [peter-evans/create-pull-request](https://github.com/peter-evans/create-pull-request) from 4.1.2 to 4.1.3.
- [Release notes](https://github.com/peter-evans/create-pull-request/releases)
- [Commits](https://github.com/peter-evans/create-pull-request/compare/v4.1.2...v4.1.3)
---
updated-dependencies:
- dependency-name: peter-evans/create-pull-request
dependency-type: direct:production
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot]
---
.github/workflows/release-pr.yml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/.github/workflows/release-pr.yml b/.github/workflows/release-pr.yml
index 3b3811a498..c6daccbcec 100644
--- a/.github/workflows/release-pr.yml
+++ b/.github/workflows/release-pr.yml
@@ -37,7 +37,7 @@ jobs:
private_key: ${{ secrets.DESKTOP_RELEASES_APP_PRIVATE_KEY }}
- name: Create Release Pull Request
- uses: peter-evans/create-pull-request@v4.1.2
+ uses: peter-evans/create-pull-request@v4.1.3
if: |
startsWith(github.ref, 'refs/heads/releases/') && !contains(github.ref, 'test')
with:
From 16a6be7318e6a0cab86c680fe3214d14fb84a750 Mon Sep 17 00:00:00 2001
From: Sergio Padrino
Date: Mon, 3 Oct 2022 18:00:31 +0200
Subject: [PATCH 056/262] Manage quit events properly
---
app/src/lib/ipc-shared.ts | 2 ++
app/src/main-process/app-window.ts | 18 +++++++++++++++
app/src/main-process/main.ts | 2 ++
.../installing-update/installing-update.tsx | 22 +++++++++++--------
app/src/ui/main-process-proxy.ts | 14 ++++++++++++
5 files changed, 49 insertions(+), 9 deletions(-)
diff --git a/app/src/lib/ipc-shared.ts b/app/src/lib/ipc-shared.ts
index aa84deb7ab..b653fa5936 100644
--- a/app/src/lib/ipc-shared.ts
+++ b/app/src/lib/ipc-shared.ts
@@ -47,6 +47,7 @@ export type RequestChannels = {
log: (level: LogLevel, message: string) => void
'will-quit': () => void
'will-quit-even-updating': () => void
+ 'cancel-quit': () => void
'crash-ready': () => void
'crash-quit': () => void
'window-state-changed': (windowState: WindowState) => void
@@ -64,6 +65,7 @@ export type RequestChannels = {
blur: () => void
'update-accounts': (accounts: ReadonlyArray) => void
'quit-and-install-updates': () => void
+ 'quit-app': () => void
'minimize-window': () => void
'maximize-window': () => void
'unmaximize-window': () => void
diff --git a/app/src/main-process/app-window.ts b/app/src/main-process/app-window.ts
index 84a1ffd880..421b912ccd 100644
--- a/app/src/main-process/app-window.ts
+++ b/app/src/main-process/app-window.ts
@@ -103,13 +103,31 @@ export class AppWindow {
event.returnValue = true
})
+ ipcMain.on('cancel-quit', event => {
+ quitting = false
+ quittingEvenDownloadingUpdate = false
+ event.returnValue = true
+ })
+
this.window.on('close', e => {
+ // On macOS, closing the window doesn't mean the app is quitting. If the
+ // app is updating, we will prevent the window from closing only when the
+ // app is also quitting.
if (
+ (!__DARWIN__ || quitting) &&
!quittingEvenDownloadingUpdate &&
+ // TODO: DON'T MERGE THIS 1!== NaN!!!!
(1 !== NaN || this.isDownloadingUpdate)
) {
e.preventDefault()
ipcWebContents.send(this.window.webContents, 'show-installing-update')
+
+ // Make sure the window is visible, so the user can see why we're
+ // preventing the app from quitting. This is important on macOS, where
+ // the window could be hidden/closed when the user tries to quit.
+ // It could also happen on Windows if the user quits the app from the
+ // task bar while it's in the background.
+ this.show()
return
}
diff --git a/app/src/main-process/main.ts b/app/src/main-process/main.ts
index 6107895ca5..640c3a4414 100644
--- a/app/src/main-process/main.ts
+++ b/app/src/main-process/main.ts
@@ -490,6 +490,8 @@ app.on('ready', () => {
mainWindow?.quitAndInstallUpdate()
)
+ ipcMain.on('quit-app', () => app.quit())
+
ipcMain.on('minimize-window', () => mainWindow?.minimizeWindow())
ipcMain.on('maximize-window', () => mainWindow?.maximizeWindow())
diff --git a/app/src/ui/installing-update/installing-update.tsx b/app/src/ui/installing-update/installing-update.tsx
index 4e1158252c..7be857d8f2 100644
--- a/app/src/ui/installing-update/installing-update.tsx
+++ b/app/src/ui/installing-update/installing-update.tsx
@@ -12,12 +12,11 @@ import { Disposable } from 'event-kit'
import { Loading } from '../lib/loading'
import { assertNever } from '../../lib/fatal-error'
import {
- closeWindow,
+ quitApp,
+ sendCancelQuitSync,
sendWillQuitEvenUpdatingSync,
- sendWillQuitSync,
} from '../main-process-proxy'
import { DialogHeader } from '../dialog/header'
-import { app } from 'electron'
interface IInstallingUpdateProps {
/**
@@ -55,9 +54,7 @@ export class InstallingUpdate extends React.Component<
// If the update is not being downloaded (`UpdateStatus.UpdateAvailable`),
// i.e. if it's already downloaded or not available, close the window.
if (updateState.status !== UpdateStatus.UpdateAvailable) {
- sendWillQuitSync()
- closeWindow()
- app.quit()
+ quitApp()
}
}
@@ -118,9 +115,16 @@ export class InstallingUpdate extends React.Component<
}
private onQuitAnywayButtonClicked = () => {
+ log.info('User chose to quit anyway')
sendWillQuitEvenUpdatingSync()
- closeWindow()
- app.quit()
+ log.info('Quitting')
+ quitApp()
+ log.info('Quitted')
+ }
+
+ private onCancel = () => {
+ sendCancelQuitSync()
+ this.props.onDismissed()
}
public render() {
@@ -139,7 +143,7 @@ export class InstallingUpdate extends React.Component<
diff --git a/app/src/ui/main-process-proxy.ts b/app/src/ui/main-process-proxy.ts
index 270ddfc8b9..9b4dc3ece7 100644
--- a/app/src/ui/main-process-proxy.ts
+++ b/app/src/ui/main-process-proxy.ts
@@ -164,6 +164,9 @@ export const checkForUpdates = invokeProxy('check-for-updates', 1)
/** Tell the main process to quit the app and install updates */
export const quitAndInstallUpdate = sendProxy('quit-and-install-updates', 0)
+/** Tell the main process to quit the app */
+export const quitApp = sendProxy('quit-app', 0)
+
/** Subscribes to auto updater error events originating from the main process */
export function onAutoUpdaterError(
errorHandler: (evt: Electron.IpcRendererEvent, error: Error) => void
@@ -291,6 +294,17 @@ export function sendWillQuitEvenUpdatingSync() {
ipcRenderer.sendSync('will-quit-even-updating')
}
+/**
+ * Tell the main process that the user cancelled quitting.
+ *
+ * This event is sent synchronously to avoid any races with subsequent calls
+ * that would tell the app to quit.
+ */
+export function sendCancelQuitSync() {
+ // eslint-disable-next-line no-sync
+ ipcRenderer.sendSync('cancel-quit')
+}
+
/**
* Tell the main process to move the application to the application folder
*/
From d689c2592668886d9bab7168c2390136552b917e Mon Sep 17 00:00:00 2001
From: tidy-dev <75402236+tidy-dev@users.noreply.github.com>
Date: Mon, 3 Oct 2022 12:07:13 -0400
Subject: [PATCH 057/262] Semi bold button text
---
app/styles/ui/_popover-dropdown.scss | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/app/styles/ui/_popover-dropdown.scss b/app/styles/ui/_popover-dropdown.scss
index 6a0ccdba23..6b8b20dafb 100644
--- a/app/styles/ui/_popover-dropdown.scss
+++ b/app/styles/ui/_popover-dropdown.scss
@@ -1,8 +1,12 @@
.popover-dropdown-component {
display: inline-flex;
+ .button-content,
.popover-dropdown-button-label {
font-weight: var(--font-weight-semibold);
+ }
+
+ .popover-dropdown-button-label {
color: var(--text-secondary-color);
margin: 0 var(--spacing-half);
}
From 26b981b1ad37cca8afec15943d607bf6f0f0ccae Mon Sep 17 00:00:00 2001
From: tidy-dev <75402236+tidy-dev@users.noreply.github.com>
Date: Tue, 4 Oct 2022 08:18:49 -0400
Subject: [PATCH 058/262] Use undo commit key
---
app/src/lib/stores/app-store.ts | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/app/src/lib/stores/app-store.ts b/app/src/lib/stores/app-store.ts
index 7dea0b780d..8f8541a540 100644
--- a/app/src/lib/stores/app-store.ts
+++ b/app/src/lib/stores/app-store.ts
@@ -5261,7 +5261,7 @@ export class AppStore extends TypedBaseStore {
public _setConfirmUndoCommitSetting(value: boolean): Promise {
this.confirmUndoCommit = value
- setBoolean(confirmForcePushKey, value)
+ setBoolean(confirmUndoCommitKey, value)
this.emitUpdate()
From f9365ef957c582e19622ec24ae7909f454b9b7d1 Mon Sep 17 00:00:00 2001
From: Tsvetilian Yankov
Date: Tue, 4 Oct 2022 23:26:23 +0300
Subject: [PATCH 059/262] Fix typo
Co-authored-by: Sergio Padrino
---
app/src/lib/app-state.ts | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/app/src/lib/app-state.ts b/app/src/lib/app-state.ts
index d7277a281f..19a1cce3f9 100644
--- a/app/src/lib/app-state.ts
+++ b/app/src/lib/app-state.ts
@@ -194,7 +194,7 @@ export interface IAppState {
/** Whether we should show a confirmation dialog */
readonly askForConfirmationOnDiscardChangesPermanently: boolean
- /** Should the app propt the user to confirm a discard stash */
+ /** Should the app prompt the user to confirm a discard stash */
readonly askForConfirmationOnDiscardStash: boolean
/** Should the app prompt the user to confirm a force push? */
From f7ea1bcb0b16143713f84d835426f3e16aabd77e Mon Sep 17 00:00:00 2001
From: Sergio Padrino
Date: Wed, 5 Oct 2022 16:36:17 +0200
Subject: [PATCH 060/262] Be more explicit about code that must be reverted
before merging
---
app/src/ui/lib/update-store.ts | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/app/src/ui/lib/update-store.ts b/app/src/ui/lib/update-store.ts
index 00e8c71c62..03d93b4aad 100644
--- a/app/src/ui/lib/update-store.ts
+++ b/app/src/ui/lib/update-store.ts
@@ -56,7 +56,7 @@ export interface IUpdateState {
/** A store which contains the current state of the auto updater. */
class UpdateStore {
private emitter = new Emitter()
- private status = UpdateStatus.UpdateAvailable // UpdateStatus.UpdateNotChecked
+ private status = UpdateStatus.UpdateAvailable // // TODO: DON'T MERGE THIS, IT SHOULD BE UpdateStatus.UpdateNotChecked
private lastSuccessfulCheck: Date | null = null
private newReleases: ReadonlyArray | null = null
private isX64ToARM64ImmediateAutoUpdate: boolean = false
From 1e7b08caf26918283b882e1e8d98e3dc6d1ac124 Mon Sep 17 00:00:00 2001
From: Sergio Padrino
Date: Wed, 5 Oct 2022 16:38:57 +0200
Subject: [PATCH 061/262] Use proper English :lol:
Co-Authored-By: Markus Olsson <634063+niik@users.noreply.github.com>
---
app/src/lib/ipc-shared.ts | 2 +-
app/src/main-process/app-window.ts | 10 +++++-----
app/src/ui/main-process-proxy.ts | 2 +-
3 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/app/src/lib/ipc-shared.ts b/app/src/lib/ipc-shared.ts
index b653fa5936..dba95a0688 100644
--- a/app/src/lib/ipc-shared.ts
+++ b/app/src/lib/ipc-shared.ts
@@ -46,7 +46,7 @@ export type RequestChannels = {
'menu-event': (name: MenuEvent) => void
log: (level: LogLevel, message: string) => void
'will-quit': () => void
- 'will-quit-even-updating': () => void
+ 'will-quit-even-if-updating': () => void
'cancel-quit': () => void
'crash-ready': () => void
'crash-quit': () => void
diff --git a/app/src/main-process/app-window.ts b/app/src/main-process/app-window.ts
index 421b912ccd..6d1b6a990d 100644
--- a/app/src/main-process/app-window.ts
+++ b/app/src/main-process/app-window.ts
@@ -87,7 +87,7 @@ export class AppWindow {
this.shouldMaximizeOnShow = savedWindowState.isMaximized
let quitting = false
- let quittingEvenDownloadingUpdate = false
+ let quittingEvenIfUpdating = false
app.on('before-quit', () => {
quitting = true
})
@@ -97,15 +97,15 @@ export class AppWindow {
event.returnValue = true
})
- ipcMain.on('will-quit-even-updating', event => {
+ ipcMain.on('will-quit-even-if-updating', event => {
quitting = true
- quittingEvenDownloadingUpdate = true
+ quittingEvenIfUpdating = true
event.returnValue = true
})
ipcMain.on('cancel-quit', event => {
quitting = false
- quittingEvenDownloadingUpdate = false
+ quittingEvenIfUpdating = false
event.returnValue = true
})
@@ -115,7 +115,7 @@ export class AppWindow {
// app is also quitting.
if (
(!__DARWIN__ || quitting) &&
- !quittingEvenDownloadingUpdate &&
+ !quittingEvenIfUpdating &&
// TODO: DON'T MERGE THIS 1!== NaN!!!!
(1 !== NaN || this.isDownloadingUpdate)
) {
diff --git a/app/src/ui/main-process-proxy.ts b/app/src/ui/main-process-proxy.ts
index 9b4dc3ece7..d8436d80f7 100644
--- a/app/src/ui/main-process-proxy.ts
+++ b/app/src/ui/main-process-proxy.ts
@@ -291,7 +291,7 @@ export function sendWillQuitSync() {
*/
export function sendWillQuitEvenUpdatingSync() {
// eslint-disable-next-line no-sync
- ipcRenderer.sendSync('will-quit-even-updating')
+ ipcRenderer.sendSync('will-quit-even-if-updating')
}
/**
From dd4dd3d42b06f80235718e8212b365fd351dd1ce Mon Sep 17 00:00:00 2001
From: Sergio Padrino
Date: Wed, 5 Oct 2022 16:39:32 +0200
Subject: [PATCH 062/262] Remove unnecessary logging
---
app/src/ui/installing-update/installing-update.tsx | 3 ---
1 file changed, 3 deletions(-)
diff --git a/app/src/ui/installing-update/installing-update.tsx b/app/src/ui/installing-update/installing-update.tsx
index 7be857d8f2..20a033ab37 100644
--- a/app/src/ui/installing-update/installing-update.tsx
+++ b/app/src/ui/installing-update/installing-update.tsx
@@ -115,11 +115,8 @@ export class InstallingUpdate extends React.Component<
}
private onQuitAnywayButtonClicked = () => {
- log.info('User chose to quit anyway')
sendWillQuitEvenUpdatingSync()
- log.info('Quitting')
quitApp()
- log.info('Quitted')
}
private onCancel = () => {
From f575c3f5c016c1142a343071630fa7009fba3b42 Mon Sep 17 00:00:00 2001
From: Sergio Padrino
Date: Wed, 5 Oct 2022 16:40:53 +0200
Subject: [PATCH 063/262] User proper English (part 2)
Co-Authored-By: Markus Olsson <634063+niik@users.noreply.github.com>
---
app/src/ui/installing-update/installing-update.tsx | 4 ++--
app/src/ui/main-process-proxy.ts | 2 +-
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/app/src/ui/installing-update/installing-update.tsx b/app/src/ui/installing-update/installing-update.tsx
index 20a033ab37..800f25c68a 100644
--- a/app/src/ui/installing-update/installing-update.tsx
+++ b/app/src/ui/installing-update/installing-update.tsx
@@ -14,7 +14,7 @@ import { assertNever } from '../../lib/fatal-error'
import {
quitApp,
sendCancelQuitSync,
- sendWillQuitEvenUpdatingSync,
+ sendWillQuitEvenIfUpdatingSync,
} from '../main-process-proxy'
import { DialogHeader } from '../dialog/header'
@@ -115,7 +115,7 @@ export class InstallingUpdate extends React.Component<
}
private onQuitAnywayButtonClicked = () => {
- sendWillQuitEvenUpdatingSync()
+ sendWillQuitEvenIfUpdatingSync()
quitApp()
}
diff --git a/app/src/ui/main-process-proxy.ts b/app/src/ui/main-process-proxy.ts
index d8436d80f7..d1f74c717d 100644
--- a/app/src/ui/main-process-proxy.ts
+++ b/app/src/ui/main-process-proxy.ts
@@ -289,7 +289,7 @@ export function sendWillQuitSync() {
* This event is sent synchronously to avoid any races with subsequent calls
* that would tell the app to quit.
*/
-export function sendWillQuitEvenUpdatingSync() {
+export function sendWillQuitEvenIfUpdatingSync() {
// eslint-disable-next-line no-sync
ipcRenderer.sendSync('will-quit-even-if-updating')
}
From 426c834a117311f255cc303de28ac9c041c1242b Mon Sep 17 00:00:00 2001
From: Sergio Padrino
Date: Wed, 5 Oct 2022 16:50:07 +0200
Subject: [PATCH 064/262] Extract quitting actions to the Dispatcher/AppStore
---
app/src/lib/ipc-shared.ts | 2 +-
app/src/lib/stores/app-store.ts | 15 ++++++++++++++
app/src/main-process/app-window.ts | 2 +-
app/src/ui/dispatcher/dispatcher.ts | 20 +++++++++++++++++++
.../installing-update/installing-update.tsx | 15 ++++++--------
app/src/ui/main-process-proxy.ts | 4 ++--
6 files changed, 45 insertions(+), 13 deletions(-)
diff --git a/app/src/lib/ipc-shared.ts b/app/src/lib/ipc-shared.ts
index dba95a0688..a8d4b3328a 100644
--- a/app/src/lib/ipc-shared.ts
+++ b/app/src/lib/ipc-shared.ts
@@ -47,7 +47,7 @@ export type RequestChannels = {
log: (level: LogLevel, message: string) => void
'will-quit': () => void
'will-quit-even-if-updating': () => void
- 'cancel-quit': () => void
+ 'cancel-quitting': () => void
'crash-ready': () => void
'crash-quit': () => void
'window-state-changed': (windowState: WindowState) => void
diff --git a/app/src/lib/stores/app-store.ts b/app/src/lib/stores/app-store.ts
index 6856656c89..eefe329d99 100644
--- a/app/src/lib/stores/app-store.ts
+++ b/app/src/lib/stores/app-store.ts
@@ -78,6 +78,9 @@ import {
updateAccounts,
setWindowZoomFactor,
onShowInstallingUpdate,
+ sendWillQuitEvenIfUpdatingSync,
+ quitApp,
+ sendCancelQuittingSync,
} from '../../ui/main-process-proxy'
import {
API,
@@ -7386,6 +7389,18 @@ export class AppStore extends TypedBaseStore {
return Promise.resolve()
}
+
+ public _quitApp(evenIfUpdating: boolean) {
+ if (evenIfUpdating) {
+ sendWillQuitEvenIfUpdatingSync()
+ }
+
+ quitApp()
+ }
+
+ public _cancelQuittingApp() {
+ sendCancelQuittingSync()
+ }
}
/**
diff --git a/app/src/main-process/app-window.ts b/app/src/main-process/app-window.ts
index 6d1b6a990d..369a1039e8 100644
--- a/app/src/main-process/app-window.ts
+++ b/app/src/main-process/app-window.ts
@@ -103,7 +103,7 @@ export class AppWindow {
event.returnValue = true
})
- ipcMain.on('cancel-quit', event => {
+ ipcMain.on('cancel-quitting', event => {
quitting = false
quittingEvenIfUpdating = false
event.returnValue = true
diff --git a/app/src/ui/dispatcher/dispatcher.ts b/app/src/ui/dispatcher/dispatcher.ts
index dec5515def..2ff714d4f2 100644
--- a/app/src/ui/dispatcher/dispatcher.ts
+++ b/app/src/ui/dispatcher/dispatcher.ts
@@ -4001,4 +4001,24 @@ export class Dispatcher {
public resetPullRequestFileListWidth(): Promise {
return this.appStore._resetPullRequestFileListWidth()
}
+
+ /**
+ * Attempts to quit the app if it's not updating, unless requested to quit
+ * even if it is updating.
+ *
+ * @param evenIfUpdating Whether to quit even if the app is updating.
+ */
+ public quitApp(evenIfUpdating: boolean) {
+ this.appStore._quitApp(evenIfUpdating)
+ }
+
+ /**
+ * Cancels quitting the app. This could be needed if, on macOS, the user tries
+ * to quit the app while an update is in progress, but then after being
+ * informed about the issues that could cause they decided to not close the
+ * app yet.
+ */
+ public cancelQuittingApp() {
+ this.appStore._cancelQuittingApp()
+ }
}
diff --git a/app/src/ui/installing-update/installing-update.tsx b/app/src/ui/installing-update/installing-update.tsx
index 800f25c68a..fdba0cd600 100644
--- a/app/src/ui/installing-update/installing-update.tsx
+++ b/app/src/ui/installing-update/installing-update.tsx
@@ -11,12 +11,8 @@ import { updateStore, IUpdateState, UpdateStatus } from '../lib/update-store'
import { Disposable } from 'event-kit'
import { Loading } from '../lib/loading'
import { assertNever } from '../../lib/fatal-error'
-import {
- quitApp,
- sendCancelQuitSync,
- sendWillQuitEvenIfUpdatingSync,
-} from '../main-process-proxy'
import { DialogHeader } from '../dialog/header'
+import { Dispatcher } from '../dispatcher'
interface IInstallingUpdateProps {
/**
@@ -24,6 +20,8 @@ interface IInstallingUpdateProps {
* ways described in the Dialog component's dismissable prop.
*/
readonly onDismissed: () => void
+
+ readonly dispatcher: Dispatcher
}
interface IInstallingUpdateState {
@@ -54,7 +52,7 @@ export class InstallingUpdate extends React.Component<
// If the update is not being downloaded (`UpdateStatus.UpdateAvailable`),
// i.e. if it's already downloaded or not available, close the window.
if (updateState.status !== UpdateStatus.UpdateAvailable) {
- quitApp()
+ this.props.dispatcher.quitApp(false)
}
}
@@ -115,12 +113,11 @@ export class InstallingUpdate extends React.Component<
}
private onQuitAnywayButtonClicked = () => {
- sendWillQuitEvenIfUpdatingSync()
- quitApp()
+ this.props.dispatcher.quitApp(true)
}
private onCancel = () => {
- sendCancelQuitSync()
+ this.props.dispatcher.cancelQuittingApp()
this.props.onDismissed()
}
diff --git a/app/src/ui/main-process-proxy.ts b/app/src/ui/main-process-proxy.ts
index d1f74c717d..7d43837163 100644
--- a/app/src/ui/main-process-proxy.ts
+++ b/app/src/ui/main-process-proxy.ts
@@ -300,9 +300,9 @@ export function sendWillQuitEvenIfUpdatingSync() {
* This event is sent synchronously to avoid any races with subsequent calls
* that would tell the app to quit.
*/
-export function sendCancelQuitSync() {
+export function sendCancelQuittingSync() {
// eslint-disable-next-line no-sync
- ipcRenderer.sendSync('cancel-quit')
+ ipcRenderer.sendSync('cancel-quitting')
}
/**
From 49f4a64a8df22d35e2e19cf5e32d45b9414e230d Mon Sep 17 00:00:00 2001
From: Sergio Padrino
Date: Wed, 5 Oct 2022 17:19:40 +0200
Subject: [PATCH 065/262] =?UTF-8?q?Don't=20forget=20the=20dispatcher?=
=?UTF-8?q?=E2=80=A6?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/src/ui/app.tsx | 1 +
1 file changed, 1 insertion(+)
diff --git a/app/src/ui/app.tsx b/app/src/ui/app.tsx
index 8adb22fd01..44f86ba52f 100644
--- a/app/src/ui/app.tsx
+++ b/app/src/ui/app.tsx
@@ -2299,6 +2299,7 @@ export class App extends React.Component {
return (
)
From c8ea1957af26f400c7ce609779d957aea9df03d3 Mon Sep 17 00:00:00 2001
From: Sergio Padrino
Date: Wed, 5 Oct 2022 17:40:48 +0200
Subject: [PATCH 066/262] Improve UI
---
.../installing-update/installing-update.tsx | 68 +++----------------
app/styles/ui/_dialog.scss | 1 +
app/styles/ui/dialogs/_installing-update.scss | 7 ++
3 files changed, 19 insertions(+), 57 deletions(-)
create mode 100644 app/styles/ui/dialogs/_installing-update.scss
diff --git a/app/src/ui/installing-update/installing-update.tsx b/app/src/ui/installing-update/installing-update.tsx
index fdba0cd600..308381cabc 100644
--- a/app/src/ui/installing-update/installing-update.tsx
+++ b/app/src/ui/installing-update/installing-update.tsx
@@ -10,7 +10,6 @@ import {
import { updateStore, IUpdateState, UpdateStatus } from '../lib/update-store'
import { Disposable } from 'event-kit'
import { Loading } from '../lib/loading'
-import { assertNever } from '../../lib/fatal-error'
import { DialogHeader } from '../dialog/header'
import { Dispatcher } from '../dispatcher'
@@ -24,31 +23,18 @@ interface IInstallingUpdateProps {
readonly dispatcher: Dispatcher
}
-interface IInstallingUpdateState {
- readonly updateState: IUpdateState
-}
-
/**
* A dialog that presents information about the
* running application such as name and version.
*/
-export class InstallingUpdate extends React.Component<
- IInstallingUpdateProps,
- IInstallingUpdateState
-> {
+export class InstallingUpdate extends React.Component {
private updateStoreEventHandle: Disposable | null = null
public constructor(props: IInstallingUpdateProps) {
super(props)
-
- this.state = {
- updateState: updateStore.state,
- }
}
private onUpdateStateChanged = (updateState: IUpdateState) => {
- this.setState({ updateState })
-
// If the update is not being downloaded (`UpdateStatus.UpdateAvailable`),
// i.e. if it's already downloaded or not available, close the window.
if (updateState.status !== UpdateStatus.UpdateAvailable) {
@@ -72,46 +58,6 @@ export class InstallingUpdate extends React.Component<
}
}
- private renderUpdateAvailable() {
- return (
-
-
-
- Installing update… please, do not close GitHub Desktop until the
- update is completely installed.
-
-
- )
- }
-
- private renderUpdateReady() {
- return (
-
- An update has been downloaded, you can close GitHub Desktop now.
-
- )
- }
-
- private renderUpdateDetails() {
- const updateState = this.state.updateState
-
- switch (updateState.status) {
- case UpdateStatus.UpdateAvailable:
- return this.renderUpdateAvailable()
- case UpdateStatus.UpdateReady:
- return this.renderUpdateReady()
- case UpdateStatus.CheckingForUpdates:
- case UpdateStatus.UpdateNotAvailable:
- case UpdateStatus.UpdateNotChecked:
- return null
- default:
- return assertNever(
- updateState.status,
- `Unknown update status ${updateState.status}`
- )
- }
- }
-
private onQuitAnywayButtonClicked = () => {
this.props.dispatcher.quitApp(true)
}
@@ -129,10 +75,18 @@ export class InstallingUpdate extends React.Component<
dismissable={false}
>
- {this.renderUpdateDetails()}
+
+
+
+
+ Please, do not close GitHub Desktop until the update is completely
+ installed.
+
+
+
Date: Thu, 6 Oct 2022 10:53:40 +0530
Subject: [PATCH 067/262] Addressing review comments
---
app/src/main-process/menu/build-default-menu.ts | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/app/src/main-process/menu/build-default-menu.ts b/app/src/main-process/menu/build-default-menu.ts
index a661eaa78a..5da9141700 100644
--- a/app/src/main-process/menu/build-default-menu.ts
+++ b/app/src/main-process/menu/build-default-menu.ts
@@ -640,7 +640,7 @@ function emit(name: MenuEvent): ClickHandler {
}
/** The zoom steps that we support, these factors must sorted */
-const ZoomInFactors = [0.25, 0.33, 0.5, 0.67, 0.75, 0.8, 0.9, 1, 1.1, 1.25, 1.5, 1.75, 2]
+const ZoomInFactors = [0.67, 0.75, 0.8, 0.9, 1, 1.1, 1.25, 1.5, 1.75, 2]
const ZoomOutFactors = ZoomInFactors.slice().reverse()
/**
From 7a9ac0f2f987ac7fafd0f9f652cab0c28c118f12 Mon Sep 17 00:00:00 2001
From: tidy-dev <75402236+tidy-dev@users.noreply.github.com>
Date: Tue, 4 Oct 2022 08:13:30 -0400
Subject: [PATCH 068/262] Add merge status to pull request state
---
app/src/lib/app-state.ts | 3 ++
app/src/lib/stores/app-store.ts | 66 +++++++++++++++++++++++++++++++++
2 files changed, 69 insertions(+)
diff --git a/app/src/lib/app-state.ts b/app/src/lib/app-state.ts
index 1dd95f3a39..08ead91bc3 100644
--- a/app/src/lib/app-state.ts
+++ b/app/src/lib/app-state.ts
@@ -974,4 +974,7 @@ export interface IPullRequestState {
* diff between the latest commit and the earliest commits parent.
*/
readonly commitSelection: ICommitSelection
+
+ /** The result of merging the pull request branch into the base branch */
+ readonly mergeStatus: MergeTreeResult | null
}
diff --git a/app/src/lib/stores/app-store.ts b/app/src/lib/stores/app-store.ts
index f58777362c..8c8ea53bf2 100644
--- a/app/src/lib/stores/app-store.ts
+++ b/app/src/lib/stores/app-store.ts
@@ -473,6 +473,7 @@ export class AppStore extends TypedBaseStore {
private repositoryFilterText: string = ''
private currentMergeTreePromise: Promise | null = null
+ private currentPRMergeTreePromise: Promise | null = null
/** The function to resolve the current Open in Desktop flow. */
private resolveOpenInDesktop:
@@ -1480,6 +1481,40 @@ export class AppStore extends TypedBaseStore {
}
}
+ private setupMergabilityPromise(
+ repository: Repository,
+ baseBranch: Branch,
+ compareBranch: Branch,
+ onLoad: (mergeTreeResult: MergeTreeResult | null) => void,
+ cleanup: () => void
+ ) {
+ const mergeTreePromise = promiseWithMinimumTimeout(
+ () => determineMergeability(repository, baseBranch, compareBranch),
+ 500
+ )
+ .catch(err => {
+ log.warn(
+ `Error occurred while trying to merge ${baseBranch.name} (${baseBranch.tip.sha}) and ${compareBranch.name} (${compareBranch.tip.sha})`,
+ err
+ )
+ return null
+ })
+ .then(mergeStatus => {
+ this.repositoryStateCache.updateCompareState(repository, () => ({
+ mergeStatus,
+ }))
+
+ this.emitUpdate()
+ })
+ .finally(() => {
+ this.currentMergeTreePromise = null
+ })
+
+ this.currentMergeTreePromise = mergeTreePromise
+
+ return this.currentMergeTreePromise
+ }
+
/** This shouldn't be called directly. See `Dispatcher`. */
public _updateCompareForm(
repository: Repository,
@@ -7281,10 +7316,15 @@ export class AppStore extends TypedBaseStore {
file: null,
diff: null,
},
+ mergeStatus: {
+ kind: ComputedAction.Loading,
+ },
})
this.emitUpdate()
+ this.setupPRMergeTreePromise(repository, baseBranch, currentBranch)
+
if (changesetData.files.length > 0) {
await this._changePullRequestFileSelection(
repository,
@@ -7426,6 +7466,32 @@ export class AppStore extends TypedBaseStore {
this._initializePullRequestPreview(repository, baseBranch, tip.branch)
}
+
+ private setupPRMergeTreePromise(
+ repository: Repository,
+ baseBranch: Branch,
+ compareBranch: Branch
+ ) {
+ // Not sure why we do this..following pattern from compare branch setup
+ if (this.currentPRMergeTreePromise != null) {
+ return
+ }
+
+ this.currentPRMergeTreePromise = this.setupMergabilityPromise(
+ repository,
+ baseBranch,
+ compareBranch,
+ (mergeStatus: MergeTreeResult | null) => {
+ this.repositoryStateCache.updatePullRequestState(repository, () => ({
+ mergeStatus,
+ }))
+ this.emitUpdate()
+ },
+ () => {
+ this.currentPRMergeTreePromise = null
+ }
+ )
+ }
}
/**
From 00edd315a145ff1a632a7396bd34955b9406c220 Mon Sep 17 00:00:00 2001
From: tidy-dev <75402236+tidy-dev@users.noreply.github.com>
Date: Tue, 4 Oct 2022 11:54:01 -0400
Subject: [PATCH 069/262] Create pull-request-merge-status.tsx
---
.../pull-request-merge-status.tsx | 15 +++++++++++++++
1 file changed, 15 insertions(+)
create mode 100644 app/src/ui/open-pull-request/pull-request-merge-status.tsx
diff --git a/app/src/ui/open-pull-request/pull-request-merge-status.tsx b/app/src/ui/open-pull-request/pull-request-merge-status.tsx
new file mode 100644
index 0000000000..b928724e04
--- /dev/null
+++ b/app/src/ui/open-pull-request/pull-request-merge-status.tsx
@@ -0,0 +1,15 @@
+import * as React from 'react'
+import { MergeResult } from '../../lib/git'
+
+interface IPullRequestMergeStatusProps {
+ /** The result of merging the pull request branch into the base branch */
+ readonly mergeStatus: MergeResult
+}
+
+/** The component to display message about the result of merging the pull
+ * request. */
+export class PullRequestMergeStatus extends React.Component {
+ public render() {
+ return Merge Status
+ }
+}
From 20c666b1d9c2068ff95bfa500fdfa57dd517f823 Mon Sep 17 00:00:00 2001
From: tidy-dev <75402236+tidy-dev@users.noreply.github.com>
Date: Tue, 4 Oct 2022 12:45:07 -0400
Subject: [PATCH 070/262] Add merge status component to dialog
---
app/src/ui/open-pull-request/open-pull-request-dialog.tsx | 3 +++
.../ui/open-pull-request/pull-request-merge-status.tsx | 6 +++---
app/styles/ui/dialogs/_open-pull-request.scss | 8 ++++++++
3 files changed, 14 insertions(+), 3 deletions(-)
diff --git a/app/src/ui/open-pull-request/open-pull-request-dialog.tsx b/app/src/ui/open-pull-request/open-pull-request-dialog.tsx
index b9d09a4441..3e82257375 100644
--- a/app/src/ui/open-pull-request/open-pull-request-dialog.tsx
+++ b/app/src/ui/open-pull-request/open-pull-request-dialog.tsx
@@ -11,6 +11,7 @@ import { Octicon } from '../octicons'
import * as OcticonSymbol from '../octicons/octicons.generated'
import { OpenPullRequestDialogHeader } from './open-pull-request-header'
import { PullRequestFilesChanged } from './pull-request-files-changed'
+import { PullRequestMergeStatus } from './pull-request-merge-status'
interface IOpenPullRequestDialogProps {
readonly repository: Repository
@@ -167,6 +168,7 @@ export class OpenPullRequestDialog extends React.Component
+
{
public render() {
- return Merge Status
+ return Merge Status
}
}
diff --git a/app/styles/ui/dialogs/_open-pull-request.scss b/app/styles/ui/dialogs/_open-pull-request.scss
index 6cdbb91e7f..7534652ca0 100644
--- a/app/styles/ui/dialogs/_open-pull-request.scss
+++ b/app/styles/ui/dialogs/_open-pull-request.scss
@@ -31,4 +31,12 @@
justify-content: center;
padding: var(--spacing-double);
}
+
+ .dialog-footer {
+ flex-direction: row;
+ }
+
+ .pull-request-merge-status {
+ flex-grow: 1;
+ }
}
From 77ae9dc249baa4c249b9c5a59ef8762dd866baab Mon Sep 17 00:00:00 2001
From: tidy-dev <75402236+tidy-dev@users.noreply.github.com>
Date: Tue, 4 Oct 2022 13:37:27 -0400
Subject: [PATCH 071/262] Make it work..
---
app/src/lib/stores/app-store.ts | 14 +++-----------
1 file changed, 3 insertions(+), 11 deletions(-)
diff --git a/app/src/lib/stores/app-store.ts b/app/src/lib/stores/app-store.ts
index 8c8ea53bf2..d19e9f5db4 100644
--- a/app/src/lib/stores/app-store.ts
+++ b/app/src/lib/stores/app-store.ts
@@ -1488,7 +1488,7 @@ export class AppStore extends TypedBaseStore {
onLoad: (mergeTreeResult: MergeTreeResult | null) => void,
cleanup: () => void
) {
- const mergeTreePromise = promiseWithMinimumTimeout(
+ return promiseWithMinimumTimeout(
() => determineMergeability(repository, baseBranch, compareBranch),
500
)
@@ -1500,19 +1500,11 @@ export class AppStore extends TypedBaseStore {
return null
})
.then(mergeStatus => {
- this.repositoryStateCache.updateCompareState(repository, () => ({
- mergeStatus,
- }))
-
- this.emitUpdate()
+ onLoad(mergeStatus)
})
.finally(() => {
- this.currentMergeTreePromise = null
+ cleanup()
})
-
- this.currentMergeTreePromise = mergeTreePromise
-
- return this.currentMergeTreePromise
}
/** This shouldn't be called directly. See `Dispatcher`. */
From 099c0b1bcf771e987b373acb42d26113fbe9cc2c Mon Sep 17 00:00:00 2001
From: tidy-dev <75402236+tidy-dev@users.noreply.github.com>
Date: Tue, 4 Oct 2022 13:37:49 -0400
Subject: [PATCH 072/262] No need to check merge status if no changes
---
app/src/lib/stores/app-store.ts | 13 +++++++++----
1 file changed, 9 insertions(+), 4 deletions(-)
diff --git a/app/src/lib/stores/app-store.ts b/app/src/lib/stores/app-store.ts
index d19e9f5db4..9a13667b9b 100644
--- a/app/src/lib/stores/app-store.ts
+++ b/app/src/lib/stores/app-store.ts
@@ -7308,14 +7308,19 @@ export class AppStore extends TypedBaseStore {
file: null,
diff: null,
},
- mergeStatus: {
- kind: ComputedAction.Loading,
- },
+ mergeStatus:
+ commitSHAs.length > 0
+ ? {
+ kind: ComputedAction.Loading,
+ }
+ : null,
})
this.emitUpdate()
- this.setupPRMergeTreePromise(repository, baseBranch, currentBranch)
+ if (commitSHAs.length > 0) {
+ this.setupPRMergeTreePromise(repository, baseBranch, currentBranch)
+ }
if (changesetData.files.length > 0) {
await this._changePullRequestFileSelection(
From 1c7623648e647218f02f2000402ff08c5e4b9f19 Mon Sep 17 00:00:00 2001
From: tidy-dev <75402236+tidy-dev@users.noreply.github.com>
Date: Tue, 4 Oct 2022 13:38:20 -0400
Subject: [PATCH 073/262] Add messages for each merge status kind
Copying dotcom verbiage
---
.../pull-request-merge-status.tsx | 55 ++++++++++++++++++-
1 file changed, 54 insertions(+), 1 deletion(-)
diff --git a/app/src/ui/open-pull-request/pull-request-merge-status.tsx b/app/src/ui/open-pull-request/pull-request-merge-status.tsx
index 9662ddf653..41f4ab8b90 100644
--- a/app/src/ui/open-pull-request/pull-request-merge-status.tsx
+++ b/app/src/ui/open-pull-request/pull-request-merge-status.tsx
@@ -1,5 +1,9 @@
import * as React from 'react'
+import { assertNever } from '../../lib/fatal-error'
+import { ComputedAction } from '../../models/computed-action'
import { MergeTreeResult } from '../../models/merge'
+import { Octicon } from '../octicons'
+import * as OcticonSymbol from '../octicons/octicons.generated'
interface IPullRequestMergeStatusProps {
/** The result of merging the pull request branch into the base branch */
@@ -9,7 +13,56 @@ interface IPullRequestMergeStatusProps {
/** The component to display message about the result of merging the pull
* request. */
export class PullRequestMergeStatus extends React.Component {
+ private getMergeStatusDescription = () => {
+ const { mergeStatus } = this.props
+ if (mergeStatus === null) {
+ return ''
+ }
+
+ const { kind } = mergeStatus
+ switch (kind) {
+ case ComputedAction.Loading:
+ return (
+
+ Checking mergeability… Don’t worry, you can
+ still create the pull request.
+
+ )
+ case ComputedAction.Invalid:
+ return (
+
+ Error checking merge status. Don’t worry, you can
+ still create the pull request.
+
+ )
+ case ComputedAction.Clean:
+ return (
+
+
+ Able to merge.
+ {' '}
+ These branches can be automatically merged.
+
+ )
+ case ComputedAction.Conflicts:
+ return (
+
+
+ Can't automatically merge.
+ {' '}
+ Don’t worry, you can still create the pull request.
+
+ )
+ default:
+ return assertNever(kind, `Unknown merge status kind of ${kind}.`)
+ }
+ }
+
public render() {
- return Merge Status
+ return (
+
+ {this.getMergeStatusDescription()}
+
+ )
}
}
From fca7928f7324c5db5ff2c61e63fd9fa877d28d96 Mon Sep 17 00:00:00 2001
From: tidy-dev <75402236+tidy-dev@users.noreply.github.com>
Date: Tue, 4 Oct 2022 14:02:28 -0400
Subject: [PATCH 074/262] Style the messages
---
app/styles/_ui.scss | 1 +
app/styles/ui/_pull-request-merge-status.scss | 31 +++++++++++++++++++
2 files changed, 32 insertions(+)
create mode 100644 app/styles/ui/_pull-request-merge-status.scss
diff --git a/app/styles/_ui.scss b/app/styles/_ui.scss
index 53c78ec973..1122e15c7d 100644
--- a/app/styles/_ui.scss
+++ b/app/styles/_ui.scss
@@ -102,3 +102,4 @@
@import 'ui/_branch-select';
@import 'ui/_popover-dropdown';
@import 'ui/_pull-request-files-changed';
+@import 'ui/_pull-request-merge-status';
diff --git a/app/styles/ui/_pull-request-merge-status.scss b/app/styles/ui/_pull-request-merge-status.scss
new file mode 100644
index 0000000000..09cb1edb1c
--- /dev/null
+++ b/app/styles/ui/_pull-request-merge-status.scss
@@ -0,0 +1,31 @@
+.pull-request-merge-status {
+ flex-grow: 1;
+ color: var(--text-secondary-color);
+
+ .octicon {
+ vertical-align: text-bottom;
+ }
+
+ strong {
+ font-weight: var(--font-weight-semibold);
+ }
+
+ .pr-merge-status-loading {
+ strong {
+ color: var(--warning-badge-icon-color);
+ }
+ }
+
+ .pr-merge-status-invalid,
+ .pr-merge-status-conflicts {
+ strong {
+ color: var(--status-error-color);
+ }
+ }
+
+ .pr-merge-status-clean {
+ strong {
+ color: var(--status-success-color);
+ }
+ }
+}
From c4e751f6e17da3daac02fee63439ed1095b9bbcd Mon Sep 17 00:00:00 2001
From: tidy-dev <75402236+tidy-dev@users.noreply.github.com>
Date: Tue, 4 Oct 2022 14:13:26 -0400
Subject: [PATCH 075/262] Reuse new method for existing logic
---
app/src/lib/stores/app-store.ts | 33 ++++++++++-----------------------
1 file changed, 10 insertions(+), 23 deletions(-)
diff --git a/app/src/lib/stores/app-store.ts b/app/src/lib/stores/app-store.ts
index 9a13667b9b..2fdf777074 100644
--- a/app/src/lib/stores/app-store.ts
+++ b/app/src/lib/stores/app-store.ts
@@ -1442,34 +1442,21 @@ export class AppStore extends TypedBaseStore {
}
if (tip.kind === TipState.Valid && aheadBehind.behind > 0) {
- const mergeTreePromise = promiseWithMinimumTimeout(
- () => determineMergeability(repository, tip.branch, action.branch),
- 500
- )
- .catch(err => {
- log.warn(
- `Error occurred while trying to merge ${tip.branch.name} (${tip.branch.tip.sha}) and ${action.branch.name} (${action.branch.tip.sha})`,
- err
- )
- return null
- })
- .then(mergeStatus => {
+ this.currentMergeTreePromise = this.setupMergabilityPromise(
+ repository,
+ tip.branch,
+ action.branch,
+ mergeStatus => {
this.repositoryStateCache.updateCompareState(repository, () => ({
mergeStatus,
}))
this.emitUpdate()
- })
-
- const cleanup = () => {
- this.currentMergeTreePromise = null
- }
-
- // TODO: when we have Promise.prototype.finally available we
- // should use that here to make this intent clearer
- mergeTreePromise.then(cleanup, cleanup)
-
- this.currentMergeTreePromise = mergeTreePromise
+ },
+ () => {
+ this.currentMergeTreePromise = null
+ }
+ )
return this.currentMergeTreePromise
} else {
From 5a3056fc720e5e5d3391589a4e4460a998deee21 Mon Sep 17 00:00:00 2001
From: tidy-dev <75402236+tidy-dev@users.noreply.github.com>
Date: Tue, 4 Oct 2022 14:18:22 -0400
Subject: [PATCH 076/262] Remove copied stuff non applicable to my use case
---
app/src/lib/stores/app-store.ts | 15 +++------------
1 file changed, 3 insertions(+), 12 deletions(-)
diff --git a/app/src/lib/stores/app-store.ts b/app/src/lib/stores/app-store.ts
index 2fdf777074..66a52a425d 100644
--- a/app/src/lib/stores/app-store.ts
+++ b/app/src/lib/stores/app-store.ts
@@ -473,7 +473,6 @@ export class AppStore extends TypedBaseStore {
private repositoryFilterText: string = ''
private currentMergeTreePromise: Promise | null = null
- private currentPRMergeTreePromise: Promise | null = null
/** The function to resolve the current Open in Desktop flow. */
private resolveOpenInDesktop:
@@ -1473,7 +1472,7 @@ export class AppStore extends TypedBaseStore {
baseBranch: Branch,
compareBranch: Branch,
onLoad: (mergeTreeResult: MergeTreeResult | null) => void,
- cleanup: () => void
+ cleanup?: () => void
) {
return promiseWithMinimumTimeout(
() => determineMergeability(repository, baseBranch, compareBranch),
@@ -1490,7 +1489,7 @@ export class AppStore extends TypedBaseStore {
onLoad(mergeStatus)
})
.finally(() => {
- cleanup()
+ cleanup?.()
})
}
@@ -7456,12 +7455,7 @@ export class AppStore extends TypedBaseStore {
baseBranch: Branch,
compareBranch: Branch
) {
- // Not sure why we do this..following pattern from compare branch setup
- if (this.currentPRMergeTreePromise != null) {
- return
- }
-
- this.currentPRMergeTreePromise = this.setupMergabilityPromise(
+ this.setupMergabilityPromise(
repository,
baseBranch,
compareBranch,
@@ -7470,9 +7464,6 @@ export class AppStore extends TypedBaseStore {
mergeStatus,
}))
this.emitUpdate()
- },
- () => {
- this.currentPRMergeTreePromise = null
}
)
}
From d8bc8464f9521d7ae5726a4daf5590a9f6c2c1b9 Mon Sep 17 00:00:00 2001
From: tidy-dev <75402236+tidy-dev@users.noreply.github.com>
Date: Tue, 4 Oct 2022 14:25:25 -0400
Subject: [PATCH 077/262] More legible warning color
---
app/styles/ui/_pull-request-merge-status.scss | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/app/styles/ui/_pull-request-merge-status.scss b/app/styles/ui/_pull-request-merge-status.scss
index 09cb1edb1c..f9d3377ae6 100644
--- a/app/styles/ui/_pull-request-merge-status.scss
+++ b/app/styles/ui/_pull-request-merge-status.scss
@@ -12,7 +12,7 @@
.pr-merge-status-loading {
strong {
- color: var(--warning-badge-icon-color);
+ color: var(--file-warning-color);
}
}
From 596aa1a991bc3cc73624c75559ec49480aa0c9a2 Mon Sep 17 00:00:00 2001
From: tidy-dev <75402236+tidy-dev@users.noreply.github.com>
Date: Thu, 6 Oct 2022 08:31:56 -0400
Subject: [PATCH 078/262] Use a promise like your supposed to..
---
app/src/lib/stores/app-store.ts | 42 ++++++++++++---------------------
1 file changed, 15 insertions(+), 27 deletions(-)
diff --git a/app/src/lib/stores/app-store.ts b/app/src/lib/stores/app-store.ts
index 66a52a425d..8e6a9cf361 100644
--- a/app/src/lib/stores/app-store.ts
+++ b/app/src/lib/stores/app-store.ts
@@ -1444,18 +1444,18 @@ export class AppStore extends TypedBaseStore {
this.currentMergeTreePromise = this.setupMergabilityPromise(
repository,
tip.branch,
- action.branch,
- mergeStatus => {
+ action.branch
+ )
+ .then(mergeStatus => {
this.repositoryStateCache.updateCompareState(repository, () => ({
mergeStatus,
}))
this.emitUpdate()
- },
- () => {
+ })
+ .finally(() => {
this.currentMergeTreePromise = null
- }
- )
+ })
return this.currentMergeTreePromise
} else {
@@ -1470,27 +1470,18 @@ export class AppStore extends TypedBaseStore {
private setupMergabilityPromise(
repository: Repository,
baseBranch: Branch,
- compareBranch: Branch,
- onLoad: (mergeTreeResult: MergeTreeResult | null) => void,
- cleanup?: () => void
+ compareBranch: Branch
) {
return promiseWithMinimumTimeout(
() => determineMergeability(repository, baseBranch, compareBranch),
500
- )
- .catch(err => {
- log.warn(
- `Error occurred while trying to merge ${baseBranch.name} (${baseBranch.tip.sha}) and ${compareBranch.name} (${compareBranch.tip.sha})`,
- err
- )
- return null
- })
- .then(mergeStatus => {
- onLoad(mergeStatus)
- })
- .finally(() => {
- cleanup?.()
- })
+ ).catch(err => {
+ log.warn(
+ `Error occurred while trying to merge ${baseBranch.name} (${baseBranch.tip.sha}) and ${compareBranch.name} (${compareBranch.tip.sha})`,
+ err
+ )
+ return null
+ })
}
/** This shouldn't be called directly. See `Dispatcher`. */
@@ -7455,10 +7446,7 @@ export class AppStore extends TypedBaseStore {
baseBranch: Branch,
compareBranch: Branch
) {
- this.setupMergabilityPromise(
- repository,
- baseBranch,
- compareBranch,
+ this.setupMergabilityPromise(repository, baseBranch, compareBranch).then(
(mergeStatus: MergeTreeResult | null) => {
this.repositoryStateCache.updatePullRequestState(repository, () => ({
mergeStatus,
From 6a4a279c7d6d36ca22d7c01d708f5a797d96cf04 Mon Sep 17 00:00:00 2001
From: tidy-dev <75402236+tidy-dev@users.noreply.github.com>
Date: Thu, 6 Oct 2022 09:03:15 -0400
Subject: [PATCH 079/262] Handle no merge base
---
app/src/lib/git/diff.ts | 20 ++++++++++++--------
app/src/lib/stores/app-store.ts | 4 ++--
app/test/unit/git/diff-test.ts | 29 +++++++++++++++++++++++++++++
3 files changed, 43 insertions(+), 10 deletions(-)
diff --git a/app/src/lib/git/diff.ts b/app/src/lib/git/diff.ts
index 8878a0af03..0f7f0fcb4d 100644
--- a/app/src/lib/git/diff.ts
+++ b/app/src/lib/git/diff.ts
@@ -254,7 +254,7 @@ export async function getBranchMergeBaseChangedFiles(
baseBranchName: string,
comparisonBranchName: string,
latestComparisonBranchCommitRef: string
-): Promise {
+): Promise {
const baseArgs = [
'diff',
'--merge-base',
@@ -268,22 +268,26 @@ export async function getBranchMergeBaseChangedFiles(
'--',
]
- const result = await git(
- baseArgs,
- repository.path,
- 'getBranchMergeBaseChangedFiles'
- )
-
const mergeBaseCommit = await getMergeBase(
repository,
baseBranchName,
comparisonBranchName
)
+ if (mergeBaseCommit === null) {
+ return null
+ }
+
+ const result = await git(
+ baseArgs,
+ repository.path,
+ 'getBranchMergeBaseChangedFiles'
+ )
+
return parseRawLogWithNumstat(
result.combinedOutput,
`${latestComparisonBranchCommitRef}`,
- mergeBaseCommit ?? NullTreeSHA
+ mergeBaseCommit
)
}
diff --git a/app/src/lib/stores/app-store.ts b/app/src/lib/stores/app-store.ts
index 8e6a9cf361..04888116ef 100644
--- a/app/src/lib/stores/app-store.ts
+++ b/app/src/lib/stores/app-store.ts
@@ -7281,7 +7281,7 @@ export class AppStore extends TypedBaseStore {
shas: commitSHAs,
shasInDiff: commitSHAs,
isContiguous: true,
- changesetData,
+ changesetData: changesetData !== null ? changesetData : emptyChangeSet,
file: null,
diff: null,
},
@@ -7299,7 +7299,7 @@ export class AppStore extends TypedBaseStore {
this.setupPRMergeTreePromise(repository, baseBranch, currentBranch)
}
- if (changesetData.files.length > 0) {
+ if (changesetData !== null && changesetData.files.length > 0) {
await this._changePullRequestFileSelection(
repository,
changesetData.files[0]
diff --git a/app/test/unit/git/diff-test.ts b/app/test/unit/git/diff-test.ts
index 4ba2f5d8fd..8e1a2f198d 100644
--- a/app/test/unit/git/diff-test.ts
+++ b/app/test/unit/git/diff-test.ts
@@ -575,9 +575,38 @@ describe('git/diff', () => {
'feature-branch',
'irrelevantToTest'
)
+
+ expect(changesetData).not.toBeNull()
+ if (changesetData === null) {
+ return
+ }
+
expect(changesetData.files).toHaveLength(1)
expect(changesetData.files[0].path).toBe('feature.md')
})
+
+ it('returns null for unrelated histories', async () => {
+ // create a second branch that's orphaned from our current branch
+ await GitProcess.exec(
+ ['checkout', '--orphan', 'orphaned-branch'],
+ repository.path
+ )
+
+ // add a commit to this new branch
+ await GitProcess.exec(
+ ['commit', '--allow-empty', '-m', `first commit on gh-pages`],
+ repository.path
+ )
+
+ const changesetData = await getBranchMergeBaseChangedFiles(
+ repository,
+ 'master',
+ 'feature-branch',
+ 'irrelevantToTest'
+ )
+
+ expect(changesetData).toBeNull()
+ })
})
describe('getBranchMergeBaseDiff', () => {
From fbd5def4a345057e0c3a454d8b2978c2750a7823 Mon Sep 17 00:00:00 2001
From: tidy-dev <75402236+tidy-dev@users.noreply.github.com>
Date: Thu, 6 Oct 2022 09:05:08 -0400
Subject: [PATCH 080/262] Update invalid to represent unrelated histories
---
app/src/ui/open-pull-request/pull-request-merge-status.tsx | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/app/src/ui/open-pull-request/pull-request-merge-status.tsx b/app/src/ui/open-pull-request/pull-request-merge-status.tsx
index 41f4ab8b90..beebe4ddfe 100644
--- a/app/src/ui/open-pull-request/pull-request-merge-status.tsx
+++ b/app/src/ui/open-pull-request/pull-request-merge-status.tsx
@@ -31,8 +31,8 @@ export class PullRequestMergeStatus extends React.Component
- Error checking merge status. Don’t worry, you can
- still create the pull request.
+ Error checking merge status. Unable to merge
+ unrelated histories in this repository
)
case ComputedAction.Clean:
From 7d1ecec457cf1ed06bcd2ae17da8e5950705f05e Mon Sep 17 00:00:00 2001
From: tidy-dev <75402236+tidy-dev@users.noreply.github.com>
Date: Thu, 6 Oct 2022 09:21:08 -0400
Subject: [PATCH 081/262] Don't bother with mergeability check if no mergebase
---
app/src/lib/stores/app-store.ts | 19 +++++++++++++------
1 file changed, 13 insertions(+), 6 deletions(-)
diff --git a/app/src/lib/stores/app-store.ts b/app/src/lib/stores/app-store.ts
index 04888116ef..afed3ee5c9 100644
--- a/app/src/lib/stores/app-store.ts
+++ b/app/src/lib/stores/app-store.ts
@@ -7254,18 +7254,18 @@ export class AppStore extends TypedBaseStore {
currentBranch
)
- const commitSHAs = pullRequestCommits.map(c => c.sha)
+ const commitsBetweenBranches = pullRequestCommits.map(c => c.sha)
// A user may compare two branches with no changes between them.
const emptyChangeSet = { files: [], linesAdded: 0, linesDeleted: 0 }
const changesetData =
- commitSHAs.length > 0
+ commitsBetweenBranches.length > 0
? await gitStore.performFailableOperation(() =>
getBranchMergeBaseChangedFiles(
repository,
baseBranch.name,
currentBranch.name,
- commitSHAs[0]
+ commitsBetweenBranches[0]
)
)
: emptyChangeSet
@@ -7274,6 +7274,11 @@ export class AppStore extends TypedBaseStore {
return
}
+ const hasMergeBase = changesetData !== null
+ // We don't care how many commits exist on the unrelated history that
+ // can't be merged.
+ const commitSHAs = hasMergeBase ? commitsBetweenBranches : []
+
this.repositoryStateCache.initializePullRequestState(repository, {
baseBranch,
commitSHAs,
@@ -7281,14 +7286,16 @@ export class AppStore extends TypedBaseStore {
shas: commitSHAs,
shasInDiff: commitSHAs,
isContiguous: true,
- changesetData: changesetData !== null ? changesetData : emptyChangeSet,
+ changesetData: changesetData ?? emptyChangeSet,
file: null,
diff: null,
},
mergeStatus:
- commitSHAs.length > 0
+ commitSHAs.length > 0 || !hasMergeBase
? {
- kind: ComputedAction.Loading,
+ kind: hasMergeBase
+ ? ComputedAction.Loading
+ : ComputedAction.Invalid,
}
: null,
})
From 55f4d561d5b56800127e182fb28e10dd749ddf30 Mon Sep 17 00:00:00 2001
From: tidy-dev <75402236+tidy-dev@users.noreply.github.com>
Date: Thu, 6 Oct 2022 09:21:23 -0400
Subject: [PATCH 082/262] Disable create pull request button for no changes
---
app/src/ui/open-pull-request/open-pull-request-dialog.tsx | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/app/src/ui/open-pull-request/open-pull-request-dialog.tsx b/app/src/ui/open-pull-request/open-pull-request-dialog.tsx
index 3e82257375..10f0c7856a 100644
--- a/app/src/ui/open-pull-request/open-pull-request-dialog.tsx
+++ b/app/src/ui/open-pull-request/open-pull-request-dialog.tsx
@@ -168,7 +168,7 @@ export class OpenPullRequestDialog extends React.Component
)
From c2232a52c31153bc6870c4cec22e67a2aaa15e1c Mon Sep 17 00:00:00 2001
From: tidy-dev <75402236+tidy-dev@users.noreply.github.com>
Date: Thu, 6 Oct 2022 09:26:56 -0400
Subject: [PATCH 083/262] Add message about unrelated commit histories to no
changes view
---
.../open-pull-request-dialog.tsx | 19 +++++++++++++++----
1 file changed, 15 insertions(+), 4 deletions(-)
diff --git a/app/src/ui/open-pull-request/open-pull-request-dialog.tsx b/app/src/ui/open-pull-request/open-pull-request-dialog.tsx
index 10f0c7856a..4a470907dd 100644
--- a/app/src/ui/open-pull-request/open-pull-request-dialog.tsx
+++ b/app/src/ui/open-pull-request/open-pull-request-dialog.tsx
@@ -12,6 +12,7 @@ import * as OcticonSymbol from '../octicons/octicons.generated'
import { OpenPullRequestDialogHeader } from './open-pull-request-header'
import { PullRequestFilesChanged } from './pull-request-files-changed'
import { PullRequestMergeStatus } from './pull-request-merge-status'
+import { ComputedAction } from '../../models/computed-action'
interface IOpenPullRequestDialogProps {
readonly repository: Repository
@@ -148,20 +149,30 @@ export class OpenPullRequestDialog extends React.Component
+ [{baseBranch.name}] is up to date with all commits from{' '}
+ [{currentBranch.name}].
+ >
+ ) : (
+ <>
+ [{baseBranch.name}] and [{currentBranch.name}] are
+ entirely different commit histories.
+ >
+ )
return (
There are no changes.
- [{baseBranch.name}] is up to date with all commits from{' '}
- [{currentBranch.name}].
+ {message}
)
From 6eefbc96c95426fdf7d7cf156d8a90f25799c31f Mon Sep 17 00:00:00 2001
From: tidy-dev <75402236+tidy-dev@users.noreply.github.com>
Date: Thu, 6 Oct 2022 10:56:42 -0400
Subject: [PATCH 084/262] Release 3.1.2-beta1
---
app/package.json | 2 +-
app/src/lib/feature-flag.ts | 2 +-
changelog.json | 6 ++++++
3 files changed, 8 insertions(+), 2 deletions(-)
diff --git a/app/package.json b/app/package.json
index 17b1c3d945..9273708c62 100644
--- a/app/package.json
+++ b/app/package.json
@@ -3,7 +3,7 @@
"productName": "GitHub Desktop",
"bundleID": "com.github.GitHubClient",
"companyName": "GitHub, Inc.",
- "version": "3.1.1",
+ "version": "3.1.2-beta1",
"main": "./main.js",
"repository": {
"type": "git",
diff --git a/app/src/lib/feature-flag.ts b/app/src/lib/feature-flag.ts
index dccc1a383d..f411e68b1a 100644
--- a/app/src/lib/feature-flag.ts
+++ b/app/src/lib/feature-flag.ts
@@ -110,5 +110,5 @@ export function enableSubmoduleDiff(): boolean {
/** Should we enable starting pull requests? */
export function enableStartingPullRequests(): boolean {
- return enableDevelopmentFeatures()
+ return enableBetaFeatures()
}
diff --git a/changelog.json b/changelog.json
index fd84fb588e..8333912851 100644
--- a/changelog.json
+++ b/changelog.json
@@ -1,5 +1,11 @@
{
"releases": {
+ "3.1.2-beta1": [
+ "[Added] You can preview the changes a pull request from your current branch would make - #11517",
+ "[Fixed] App correctly remembers undo commit prompt setting - #15408",
+ "[Improved] Added support zooming out for the 67%, 75%, 80% and 90% zoom levels - #15401. Thanks @sathvikrijo!",
+ "[Improved] Add option to disable discard stash confirmation - #15379. Thanks @tsvetilian-ty!"
+ ],
"3.1.1": [
"[Fixed] App correctly remembers undo commit prompt setting - #15408"
],
From bccec59c0849896978f578f7e95d5578e6bedb14 Mon Sep 17 00:00:00 2001
From: tidy-dev <75402236+tidy-dev@users.noreply.github.com>
Date: Thu, 6 Oct 2022 10:58:28 -0400
Subject: [PATCH 085/262] Update changelog.json
---
changelog.json | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/changelog.json b/changelog.json
index 8333912851..4a57665760 100644
--- a/changelog.json
+++ b/changelog.json
@@ -3,7 +3,7 @@
"3.1.2-beta1": [
"[Added] You can preview the changes a pull request from your current branch would make - #11517",
"[Fixed] App correctly remembers undo commit prompt setting - #15408",
- "[Improved] Added support zooming out for the 67%, 75%, 80% and 90% zoom levels - #15401. Thanks @sathvikrijo!",
+ "[Improved] Added support for zooming out at the 67%, 75%, 80% and 90% zoom levels - #15401. Thanks @sathvikrijo!",
"[Improved] Add option to disable discard stash confirmation - #15379. Thanks @tsvetilian-ty!"
],
"3.1.1": [
From 397a12b5786b7fed522ede9103285605a76404c5 Mon Sep 17 00:00:00 2001
From: Sergio Padrino
Date: Mon, 10 Oct 2022 10:40:23 +0200
Subject: [PATCH 086/262] Update changelog.json
---
changelog.json | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/changelog.json b/changelog.json
index 4a57665760..f53274b243 100644
--- a/changelog.json
+++ b/changelog.json
@@ -3,7 +3,7 @@
"3.1.2-beta1": [
"[Added] You can preview the changes a pull request from your current branch would make - #11517",
"[Fixed] App correctly remembers undo commit prompt setting - #15408",
- "[Improved] Added support for zooming out at the 67%, 75%, 80% and 90% zoom levels - #15401. Thanks @sathvikrijo!",
+ "[Improved] Add support for zooming out at the 67%, 75%, 80% and 90% zoom levels - #15401. Thanks @sathvikrijo!",
"[Improved] Add option to disable discard stash confirmation - #15379. Thanks @tsvetilian-ty!"
],
"3.1.1": [
From 1a1abaede57556be92b44c1a5a4171c8735c730d Mon Sep 17 00:00:00 2001
From: Sergio Padrino
Date: Mon, 10 Oct 2022 14:05:29 +0200
Subject: [PATCH 087/262] Use "loading" indicator from header
---
app/src/ui/installing-update/installing-update.tsx | 12 +++++-------
1 file changed, 5 insertions(+), 7 deletions(-)
diff --git a/app/src/ui/installing-update/installing-update.tsx b/app/src/ui/installing-update/installing-update.tsx
index 308381cabc..c24afcb9ef 100644
--- a/app/src/ui/installing-update/installing-update.tsx
+++ b/app/src/ui/installing-update/installing-update.tsx
@@ -9,7 +9,6 @@ import {
} from '../dialog'
import { updateStore, IUpdateState, UpdateStatus } from '../lib/update-store'
import { Disposable } from 'event-kit'
-import { Loading } from '../lib/loading'
import { DialogHeader } from '../dialog/header'
import { Dispatcher } from '../dispatcher'
@@ -76,15 +75,14 @@ export class InstallingUpdate extends React.Component {
>
-
-
- Please, do not close GitHub Desktop until the update is completely
- installed.
-
+ Please, do not close GitHub Desktop until the update is completely
+ installed.
From c334c203c83fa116fe7c200b70cc45a480053c9d Mon Sep 17 00:00:00 2001
From: Sergio Padrino
Date: Mon, 10 Oct 2022 16:18:27 +0200
Subject: [PATCH 088/262] Revert changes we don't want merged
---
app/src/main-process/app-window.ts | 3 +--
app/src/ui/lib/update-store.ts | 2 +-
2 files changed, 2 insertions(+), 3 deletions(-)
diff --git a/app/src/main-process/app-window.ts b/app/src/main-process/app-window.ts
index 369a1039e8..7c1af9e7c9 100644
--- a/app/src/main-process/app-window.ts
+++ b/app/src/main-process/app-window.ts
@@ -116,8 +116,7 @@ export class AppWindow {
if (
(!__DARWIN__ || quitting) &&
!quittingEvenIfUpdating &&
- // TODO: DON'T MERGE THIS 1!== NaN!!!!
- (1 !== NaN || this.isDownloadingUpdate)
+ this.isDownloadingUpdate
) {
e.preventDefault()
ipcWebContents.send(this.window.webContents, 'show-installing-update')
diff --git a/app/src/ui/lib/update-store.ts b/app/src/ui/lib/update-store.ts
index 03d93b4aad..e4ad40d9ae 100644
--- a/app/src/ui/lib/update-store.ts
+++ b/app/src/ui/lib/update-store.ts
@@ -56,7 +56,7 @@ export interface IUpdateState {
/** A store which contains the current state of the auto updater. */
class UpdateStore {
private emitter = new Emitter()
- private status = UpdateStatus.UpdateAvailable // // TODO: DON'T MERGE THIS, IT SHOULD BE UpdateStatus.UpdateNotChecked
+ private status = UpdateStatus.UpdateNotChecked
private lastSuccessfulCheck: Date | null = null
private newReleases: ReadonlyArray | null = null
private isX64ToARM64ImmediateAutoUpdate: boolean = false
From 4dbcf07b3817dd31fb6ef92a10aa3b1dc3b98d58 Mon Sep 17 00:00:00 2001
From: Niko-O
Date: Mon, 10 Oct 2022 16:26:45 +0200
Subject: [PATCH 089/262] Add link to build instructions to README.md
Those instructions are otherwise buried behind 2 links. That is, I first have to see the link to CONTRIBUTING.md, then find the tiny "Set Up Your Machine" section in there. In my case, I wasn't even going at it from the perspective of trying to contribute; I just wanted to build the program. So I had a very hard time finding this information.
Adding this link here would make finding this infromation a lot easier.
---
README.md | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/README.md b/README.md
index 663a8dfedf..6a2a683452 100644
--- a/README.md
+++ b/README.md
@@ -84,6 +84,10 @@ resources relevant to the project.
If you're looking for something to work on, check out the [help wanted](https://github.com/desktop/desktop/issues?q=is%3Aissue+is%3Aopen+label%3A%22help%20wanted%22) label.
+## Building Desktop
+
+To get your development environment set up for building Desktop, see [setup.md](./docs/contributing/setup.md).
+
## More Resources
See [desktop.github.com](https://desktop.github.com) for more product-oriented
From 8c100bb0c75a52ae1ee9d7feb36fa594ff2eaadd Mon Sep 17 00:00:00 2001
From: Sergio Padrino
Date: Tue, 11 Oct 2022 13:29:10 +0200
Subject: [PATCH 090/262] Make the alert "scarier"
---
app/src/ui/installing-update/installing-update.tsx | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/app/src/ui/installing-update/installing-update.tsx b/app/src/ui/installing-update/installing-update.tsx
index c24afcb9ef..220ec8dfd8 100644
--- a/app/src/ui/installing-update/installing-update.tsx
+++ b/app/src/ui/installing-update/installing-update.tsx
@@ -72,6 +72,7 @@ export class InstallingUpdate extends React.Component {
id="installing-update"
onSubmit={this.props.onDismissed}
dismissable={false}
+ type="warning"
>
{
Please, do not close GitHub Desktop until the update is completely
- installed.
+ installed. Quitting the app now may result in a corrupted
+ installation.
@@ -90,6 +92,7 @@ export class InstallingUpdate extends React.Component {
okButtonText={__DARWIN__ ? 'Quit Anyway' : 'Quit anyway'}
onOkButtonClick={this.onQuitAnywayButtonClicked}
onCancelButtonClick={this.onCancel}
+ destructive={true}
/>
From 58554a6182b6c1490163bb25f257741a1d57ee4d Mon Sep 17 00:00:00 2001
From: Sergio Padrino
Date: Tue, 11 Oct 2022 13:45:25 +0200
Subject: [PATCH 091/262] Improve verbiage
Co-Authored-By: Maximilian Sachs <15086212+masachs@users.noreply.github.com>
---
app/src/ui/installing-update/installing-update.tsx | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/app/src/ui/installing-update/installing-update.tsx b/app/src/ui/installing-update/installing-update.tsx
index 220ec8dfd8..239d04c85b 100644
--- a/app/src/ui/installing-update/installing-update.tsx
+++ b/app/src/ui/installing-update/installing-update.tsx
@@ -82,9 +82,8 @@ export class InstallingUpdate extends React.Component {
/>
- Please, do not close GitHub Desktop until the update is completely
- installed. Quitting the app now may result in a corrupted
- installation.
+ Do not close GitHub Desktop while the update is in progress. Closing
+ now may break your installation.
From 4e3ff0a7c88ad64b15930a3203c73124ba44b051 Mon Sep 17 00:00:00 2001
From: Sergio Padrino
Date: Tue, 11 Oct 2022 17:10:36 +0200
Subject: [PATCH 092/262] Calculate the gutter width for unified diffs properly
---
app/src/ui/diff/side-by-side-diff-row.tsx | 23 +++++++++++++++--------
1 file changed, 15 insertions(+), 8 deletions(-)
diff --git a/app/src/ui/diff/side-by-side-diff-row.tsx b/app/src/ui/diff/side-by-side-diff-row.tsx
index 1223f7215c..8aa385b462 100644
--- a/app/src/ui/diff/side-by-side-diff-row.tsx
+++ b/app/src/ui/diff/side-by-side-diff-row.tsx
@@ -363,6 +363,16 @@ export class SideBySideDiffRow extends React.Component<
throw new Error(`Unexpected expansion type ${expansionType}`)
}
+ /**
+ * This method returns the width of a line gutter in pixels. For unified diffs
+ * the gutter contains the line number of both before and after sides, whereas
+ * for side-by-side diffs the gutter contains the line number of only one side.
+ */
+ private get lineGutterWidth() {
+ const { showSideBySideDiff, lineNumberWidth } = this.props
+ return showSideBySideDiff ? lineNumberWidth : lineNumberWidth * 2
+ }
+
private renderHunkExpansionHandle(
hunkIndex: number,
expansionType: DiffHunkExpansionType
@@ -372,7 +382,7 @@ export class SideBySideDiffRow extends React.Component<
@@ -389,7 +399,7 @@ export class SideBySideDiffRow extends React.Component<
+
{lineNumbers.map((lineNumber, index) => (
{lineNumber}
))}
@@ -470,7 +477,7 @@ export class SideBySideDiffRow extends React.Component<
'line-selected': isSelected,
hover: this.props.isHunkHovered,
})}
- style={{ width: this.props.lineNumberWidth }}
+ style={{ width: this.lineGutterWidth }}
onMouseDown={this.onMouseDownLineNumber}
onContextMenu={this.onContextMenuLineNumber}
>
@@ -493,7 +500,7 @@ export class SideBySideDiffRow extends React.Component<
const style: React.CSSProperties = {
[column === DiffColumn.Before ? 'marginRight' : 'marginLeft']:
- this.props.lineNumberWidth + 10,
+ this.lineGutterWidth + 10,
marginTop: -10,
}
From b1b0a6f25c707c0f068e47169c588c342b7f21a8 Mon Sep 17 00:00:00 2001
From: Sergio Padrino
Date: Tue, 11 Oct 2022 17:10:56 +0200
Subject: [PATCH 093/262] Fix colors of hunk handle in unified diff
---
app/styles/ui/_side-by-side-diff.scss | 15 ++++++++++++---
1 file changed, 12 insertions(+), 3 deletions(-)
diff --git a/app/styles/ui/_side-by-side-diff.scss b/app/styles/ui/_side-by-side-diff.scss
index b16bcb85c2..5d86956932 100644
--- a/app/styles/ui/_side-by-side-diff.scss
+++ b/app/styles/ui/_side-by-side-diff.scss
@@ -322,13 +322,22 @@
flex-direction: row;
}
+
.hunk-handle {
left: 100px;
}
- &.hunk-info .line-number {
- background: var(--diff-hunk-gutter-background-color);
- border-color: var(--diff-hunk-border-color);
+ &.hunk-info {
+ .line-number {
+ background: var(--diff-hunk-gutter-background-color);
+ border-color: var(--diff-hunk-border-color);
+ }
+ .hunk-expansion-handle {
+ background: var(--diff-hunk-gutter-background-color);
+ border-right-width: 4px;
+ border-right-style: solid;
+ border-color: var(--diff-hunk-gutter-background-color);
+ }
}
.line-number {
From f2d7d3281d25ac6fbd7d428894aa427867600547 Mon Sep 17 00:00:00 2001
From: Sergio Padrino
Date: Tue, 11 Oct 2022 17:11:06 +0200
Subject: [PATCH 094/262] Enable experimental diff viewer for unified diffs
---
app/src/lib/feature-flag.ts | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/app/src/lib/feature-flag.ts b/app/src/lib/feature-flag.ts
index f411e68b1a..d5addc68fe 100644
--- a/app/src/lib/feature-flag.ts
+++ b/app/src/lib/feature-flag.ts
@@ -46,7 +46,7 @@ export function enableWSLDetection(): boolean {
* Should we use the new diff viewer for unified diffs?
*/
export function enableExperimentalDiffViewer(): boolean {
- return false
+ return enableBetaFeatures()
}
/**
From 2411ec53a75d1741b6e85a3163a9365849d59d8c Mon Sep 17 00:00:00 2001
From: Sergio Padrino
Date: Tue, 11 Oct 2022 18:05:19 +0200
Subject: [PATCH 095/262] Fix appearance of experimental diff viewer in unified
mode
---
app/styles/ui/_side-by-side-diff.scss | 21 ++++++++++++++++++---
1 file changed, 18 insertions(+), 3 deletions(-)
diff --git a/app/styles/ui/_side-by-side-diff.scss b/app/styles/ui/_side-by-side-diff.scss
index 5d86956932..38c3de2137 100644
--- a/app/styles/ui/_side-by-side-diff.scss
+++ b/app/styles/ui/_side-by-side-diff.scss
@@ -334,9 +334,19 @@
}
.hunk-expansion-handle {
background: var(--diff-hunk-gutter-background-color);
- border-right-width: 4px;
+ border-right-width: 1px;
border-right-style: solid;
border-color: var(--diff-hunk-gutter-background-color);
+ &.selectable:hover {
+ border-color: var(--diff-hover-background-color);
+ }
+ &:not(.selectable) span {
+ // This must be the height of an octicon, so that when a hunk handle
+ // of any type is replaced by an "empty" hunk handle (e.g. when a
+ // file is completely expanded), the height of the whole line
+ // remains the same.
+ height: 16px;
+ }
}
}
@@ -358,8 +368,13 @@
}
}
- &.editable .row .line-number {
- border-right-width: 4px;
+ &.editable .row {
+ .line-number {
+ border-right-width: 4px;
+ }
+ .hunk-expansion-handle {
+ border-right-width: 4px;
+ }
}
}
From 379b7d104558c9bd0005ead368e32d0bc8d252f1 Mon Sep 17 00:00:00 2001
From: Sergio Padrino
Date: Tue, 11 Oct 2022 18:14:48 +0200
Subject: [PATCH 096/262] Fix copying all content in unified diff of
experimental diff viewer
---
app/src/ui/diff/side-by-side-diff.tsx | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/app/src/ui/diff/side-by-side-diff.tsx b/app/src/ui/diff/side-by-side-diff.tsx
index b3d026c12f..94b594dc0b 100644
--- a/app/src/ui/diff/side-by-side-diff.tsx
+++ b/app/src/ui/diff/side-by-side-diff.tsx
@@ -256,7 +256,7 @@ export class SideBySideDiff extends React.Component<
: [DiffLineType.Add, DiffLineType.Context]
: [DiffLineType.Add, DiffLineType.Delete, DiffLineType.Context]
- const contents = this.props.diff.hunks
+ const contents = this.state.diff.hunks
.flatMap(h =>
h.lines
.filter(line => lineTypes.includes(line.type))
From f3e32e8e59f85e0704a43730f84d957b5f6ed057 Mon Sep 17 00:00:00 2001
From: Sergio Padrino
Date: Tue, 11 Oct 2022 18:21:18 +0200
Subject: [PATCH 097/262] Fix cmd/control + Enter shortcut while amending a
commit
---
app/src/ui/changes/commit-message.tsx | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/app/src/ui/changes/commit-message.tsx b/app/src/ui/changes/commit-message.tsx
index 24c3355a1c..e3a9c38899 100644
--- a/app/src/ui/changes/commit-message.tsx
+++ b/app/src/ui/changes/commit-message.tsx
@@ -351,7 +351,7 @@ export class CommitMessage extends React.Component<
if (
isShortcutKey &&
event.key === 'Enter' &&
- this.canCommit() &&
+ (this.canCommit() || this.canAmend()) &&
this.canExcecuteCommitShortcut()
) {
this.createCommit()
From 8b827a336e3a0e6ae67d8585f145199441d8b757 Mon Sep 17 00:00:00 2001
From: Sergio Padrino
Date: Wed, 12 Oct 2022 10:23:52 +0200
Subject: [PATCH 098/262] =?UTF-8?q?Fix=20linting=20issue=E2=80=A6?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/styles/ui/_side-by-side-diff.scss | 1 -
1 file changed, 1 deletion(-)
diff --git a/app/styles/ui/_side-by-side-diff.scss b/app/styles/ui/_side-by-side-diff.scss
index 38c3de2137..c512cb2045 100644
--- a/app/styles/ui/_side-by-side-diff.scss
+++ b/app/styles/ui/_side-by-side-diff.scss
@@ -322,7 +322,6 @@
flex-direction: row;
}
-
.hunk-handle {
left: 100px;
}
From 581567d64b2f847b33a0d22b55986fda72210a17 Mon Sep 17 00:00:00 2001
From: Sergio Padrino
Date: Wed, 12 Oct 2022 10:45:56 +0200
Subject: [PATCH 099/262] Make sure Squirrel.Windows isn't affected by
partially or completely disabled releases
---
script/package.ts | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/script/package.ts b/script/package.ts
index 7f8566adb2..8cfd8f03c7 100644
--- a/script/package.ts
+++ b/script/package.ts
@@ -102,7 +102,11 @@ function packageWindows() {
}
if (shouldMakeDelta()) {
- options.remoteReleases = getUpdatesURL()
+ const url = new URL(getUpdatesURL())
+ // Make sure Squirrel.Windows isn't affected by partially or completely
+ // disabled releases.
+ url.searchParams.set('bypassStaggeredRelease', '1')
+ options.remoteReleases = url.toString()
}
if (isAppveyor() || isGitHubActions()) {
From 8675ea638b54b95784067858e3cf2aa60823634d Mon Sep 17 00:00:00 2001
From: Angus
Date: Sat, 15 Oct 2022 01:49:44 +0100
Subject: [PATCH 100/262] Fix avatar tooltip does not wrap properly in some
cases
---
app/styles/ui/window/_tooltips.scss | 1 +
1 file changed, 1 insertion(+)
diff --git a/app/styles/ui/window/_tooltips.scss b/app/styles/ui/window/_tooltips.scss
index 97282eda85..27f84b7439 100644
--- a/app/styles/ui/window/_tooltips.scss
+++ b/app/styles/ui/window/_tooltips.scss
@@ -11,6 +11,7 @@ body > .tooltip,
max-width: 300px;
word-wrap: break-word;
+ word-break: break-word;
overflow-wrap: break-word;
background-color: var(--tooltip-background-color);
From 56e965cb10142dbbe06e2f1e1914ba22493f3f99 Mon Sep 17 00:00:00 2001
From: Angus
Date: Sat, 15 Oct 2022 20:35:02 +0100
Subject: [PATCH 101/262] Fix issue #13636 - Tooltip position is (0,0) if mouse
is not moved
The tooltip position is referenced to mouse position set in mousemove event. If the tooltip is triggered by events other than mousemove (e.g. scroll the list with mousewheel or keyboard arrow keys, or click the Fetch Origin button without moving the mouse), the mouse position is not set (0,0). The fix is to set the mouse position in mouseenter event as well
---
app/src/ui/lib/tooltip.tsx | 2 ++
1 file changed, 2 insertions(+)
diff --git a/app/src/ui/lib/tooltip.tsx b/app/src/ui/lib/tooltip.tsx
index 6e4b05abbf..5d47f02ae4 100644
--- a/app/src/ui/lib/tooltip.tsx
+++ b/app/src/ui/lib/tooltip.tsx
@@ -300,6 +300,8 @@ export class Tooltip extends React.Component<
}
private onTargetMouseEnter = (event: MouseEvent) => {
+ this.mouseRect = new DOMRect(event.clientX - 10, event.clientY - 10, 20, 20)
+
this.mouseOverTarget = true
this.cancelHideTooltip()
if (!this.state.show) {
From 9ffb2041679feafd668f536ccaa4f745b4a70330 Mon Sep 17 00:00:00 2001
From: Angus
Date: Sun, 16 Oct 2022 00:35:25 +0100
Subject: [PATCH 102/262] Issue 11953 Progress bar during cloning partially
hidden
Close the repository list when clone starts
---
app/src/ui/clone-repository/clone-repository.tsx | 2 ++
1 file changed, 2 insertions(+)
diff --git a/app/src/ui/clone-repository/clone-repository.tsx b/app/src/ui/clone-repository/clone-repository.tsx
index d89646a093..cfca9408fc 100644
--- a/app/src/ui/clone-repository/clone-repository.tsx
+++ b/app/src/ui/clone-repository/clone-repository.tsx
@@ -3,6 +3,7 @@ import * as React from 'react'
import { Dispatcher } from '../dispatcher'
import { getDefaultDir, setDefaultDir } from '../lib/default-dir'
import { Account } from '../../models/account'
+import { FoldoutType } from '../../lib/app-state'
import {
IRepositoryIdentifier,
parseRepositoryIdentifier,
@@ -728,6 +729,7 @@ export class CloneRepository extends React.Component<
const { url, defaultBranch } = cloneInfo
+ this.props.dispatcher.closeFoldout(FoldoutType.Repository)
try {
this.cloneImpl(url.trim(), path, defaultBranch)
} catch (e) {
From aac5fd4d435081864e2794fe2f7d32c59b257473 Mon Sep 17 00:00:00 2001
From: tidy-dev <75402236+tidy-dev@users.noreply.github.com>
Date: Mon, 17 Oct 2022 08:16:22 -0400
Subject: [PATCH 103/262] Consistently disable multi commit operations
---
app/src/ui/history/commit-list-item.tsx | 33 +++++++++++++++++++------
app/src/ui/history/commit-list.tsx | 24 +++++++++++++-----
app/src/ui/history/compare.tsx | 6 +++--
app/src/ui/repository.tsx | 7 +-----
4 files changed, 48 insertions(+), 22 deletions(-)
diff --git a/app/src/ui/history/commit-list-item.tsx b/app/src/ui/history/commit-list-item.tsx
index 998342bbe5..dc4d4bb4be 100644
--- a/app/src/ui/history/commit-list-item.tsx
+++ b/app/src/ui/history/commit-list-item.tsx
@@ -51,8 +51,8 @@ interface ICommitProps {
readonly showUnpushedIndicator: boolean
readonly unpushedIndicatorTitle?: string
readonly unpushedTags?: ReadonlyArray
- readonly isCherryPickInProgress?: boolean
readonly disableSquashing?: boolean
+ readonly isMultiCommitOperationInProgress?: boolean
}
interface ICommitListItemState {
@@ -126,7 +126,7 @@ export class CommitListItem extends React.PureComponent<
author: { date },
} = commit
- const isDraggable = this.canCherryPick()
+ const isDraggable = this.isDraggable()
const hasEmptySummary = commit.summary.length === 0
const commitSummary = hasEmptySummary
? 'Empty commit message'
@@ -379,17 +379,34 @@ export class CommitListItem extends React.PureComponent<
? `Squash ${count} Commits…`
: `Squash ${count} commits…`,
action: this.onSquash,
+ enabled: this.canSquash(),
},
]
}
- private canCherryPick(): boolean {
- const { onCherryPick, isCherryPickInProgress } = this.props
+ private isDraggable(): boolean {
+ const { onCherryPick, onSquash, isMultiCommitOperationInProgress } =
+ this.props
return (
- onCherryPick !== undefined &&
- this.onSquash !== undefined &&
- isCherryPickInProgress === false
- // TODO: isSquashInProgress === false
+ (onCherryPick !== undefined || onSquash !== undefined) &&
+ isMultiCommitOperationInProgress === false
+ )
+ }
+
+ private canCherryPick(): boolean {
+ const { onCherryPick, isMultiCommitOperationInProgress } = this.props
+ return (
+ onCherryPick !== undefined && isMultiCommitOperationInProgress === false
+ )
+ }
+
+ private canSquash(): boolean {
+ const { onSquash, disableSquashing, isMultiCommitOperationInProgress } =
+ this.props
+ return (
+ onSquash !== undefined &&
+ disableSquashing === false &&
+ isMultiCommitOperationInProgress === false
)
}
diff --git a/app/src/ui/history/commit-list.tsx b/app/src/ui/history/commit-list.tsx
index d176775bac..9b4734b269 100644
--- a/app/src/ui/history/commit-list.tsx
+++ b/app/src/ui/history/commit-list.tsx
@@ -119,8 +119,9 @@ interface ICommitListProps {
/** Whether or not commits in this list can be reordered. */
readonly reorderingEnabled?: boolean
- /** Whether a cherry pick is progress */
- readonly isCherryPickInProgress?: boolean
+ /** Whether a multi commit operation is in progress (in particular the
+ * conflicts resolution step allows interaction with history) */
+ readonly isMultiCommitOperationInProgress?: boolean
/** Callback to render commit drag element */
readonly onRenderCommitDragElement?: (
@@ -213,10 +214,12 @@ export class CommitList extends React.Component {
onAmendCommit={this.props.onAmendCommit}
onViewCommitOnGitHub={this.props.onViewCommitOnGitHub}
selectedCommits={this.lookupCommits(this.props.selectedSHAs)}
- isCherryPickInProgress={this.props.isCherryPickInProgress}
onRenderCommitDragElement={this.onRenderCommitDragElement}
onRemoveDragElement={this.props.onRemoveCommitDragElement}
disableSquashing={this.props.disableSquashing}
+ isMultiCommitOperationInProgress={
+ this.props.isMultiCommitOperationInProgress
+ }
/>
)
}
@@ -374,8 +377,14 @@ export class CommitList extends React.Component {
}
public render() {
- const { commitSHAs, selectedSHAs, shasToHighlight, emptyListMessage } =
- this.props
+ const {
+ commitSHAs,
+ selectedSHAs,
+ shasToHighlight,
+ emptyListMessage,
+ reorderingEnabled,
+ isMultiCommitOperationInProgress,
+ } = this.props
if (commitSHAs.length === 0) {
return (
@@ -402,7 +411,10 @@ export class CommitList extends React.Component
{
selectionMode="multi"
onScroll={this.onScroll}
insertionDragType={
- this.props.reorderingEnabled === true ? DragType.Commit : undefined
+ reorderingEnabled === true &&
+ isMultiCommitOperationInProgress === false
+ ? DragType.Commit
+ : undefined
}
invalidationProps={{
commits: this.props.commitSHAs,
diff --git a/app/src/ui/history/compare.tsx b/app/src/ui/history/compare.tsx
index e77438ecda..ad5f8598f6 100644
--- a/app/src/ui/history/compare.tsx
+++ b/app/src/ui/history/compare.tsx
@@ -53,7 +53,7 @@ interface ICompareSidebarProps {
readonly localTags: Map | null
readonly tagsToPush: ReadonlyArray | null
readonly aheadBehindStore: AheadBehindStore
- readonly isCherryPickInProgress: boolean
+ readonly isMultiCommitOperationInProgress?: boolean
readonly shasToHighlight: ReadonlyArray
}
@@ -258,10 +258,12 @@ export class CompareSidebar extends React.Component<
onCompareListScrolled={this.props.onCompareListScrolled}
compareListScrollTop={this.props.compareListScrollTop}
tagsToPush={this.props.tagsToPush ?? []}
- isCherryPickInProgress={this.props.isCherryPickInProgress}
onRenderCommitDragElement={this.onRenderCommitDragElement}
onRemoveCommitDragElement={this.onRemoveCommitDragElement}
disableSquashing={formState.kind === HistoryTabMode.Compare}
+ isMultiCommitOperationInProgress={
+ this.props.isMultiCommitOperationInProgress
+ }
/>
)
}
diff --git a/app/src/ui/repository.tsx b/app/src/ui/repository.tsx
index 85e6e97484..10339c12ac 100644
--- a/app/src/ui/repository.tsx
+++ b/app/src/ui/repository.tsx
@@ -31,7 +31,6 @@ import { openFile } from './lib/open-file'
import { AheadBehindStore } from '../lib/stores/ahead-behind-store'
import { dragAndDropManager } from '../lib/drag-and-drop-manager'
import { DragType } from '../models/drag-drop'
-import { MultiCommitOperationKind } from '../models/multi-commit-operation'
import { clamp } from '../lib/clamp'
interface IRepositoryViewProps {
@@ -250,10 +249,6 @@ export class RepositoryView extends React.Component<
} = state
const { tip } = branchesState
const currentBranch = tip.kind === TipState.Valid ? tip.branch : null
- const isCherryPickInProgress =
- mcos !== null &&
- mcos.operationDetail.kind === MultiCommitOperationKind.CherryPick
-
const scrollTop =
this.forceCompareListScrollTop ||
this.previousSection === RepositorySectionTab.Changes
@@ -283,7 +278,7 @@ export class RepositoryView extends React.Component<
compareListScrollTop={scrollTop}
tagsToPush={tagsToPush}
aheadBehindStore={aheadBehindStore}
- isCherryPickInProgress={isCherryPickInProgress}
+ isMultiCommitOperationInProgress={mcos !== null}
/>
)
}
From 2c6cae8c1cace54eb1df91c71347718cdc8f3c34 Mon Sep 17 00:00:00 2001
From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com>
Date: Mon, 17 Oct 2022 16:08:50 +0000
Subject: [PATCH 104/262] Bump peter-evans/create-pull-request from 4.1.3 to
4.1.4
Bumps [peter-evans/create-pull-request](https://github.com/peter-evans/create-pull-request) from 4.1.3 to 4.1.4.
- [Release notes](https://github.com/peter-evans/create-pull-request/releases)
- [Commits](https://github.com/peter-evans/create-pull-request/compare/v4.1.3...v4.1.4)
---
updated-dependencies:
- dependency-name: peter-evans/create-pull-request
dependency-type: direct:production
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot]
---
.github/workflows/release-pr.yml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/.github/workflows/release-pr.yml b/.github/workflows/release-pr.yml
index c6daccbcec..c9a249428b 100644
--- a/.github/workflows/release-pr.yml
+++ b/.github/workflows/release-pr.yml
@@ -37,7 +37,7 @@ jobs:
private_key: ${{ secrets.DESKTOP_RELEASES_APP_PRIVATE_KEY }}
- name: Create Release Pull Request
- uses: peter-evans/create-pull-request@v4.1.3
+ uses: peter-evans/create-pull-request@v4.1.4
if: |
startsWith(github.ref, 'refs/heads/releases/') && !contains(github.ref, 'test')
with:
From ab9f11909e89de8f6660bad270a172063d775ac9 Mon Sep 17 00:00:00 2001
From: Angus
Date: Mon, 17 Oct 2022 17:14:27 +0100
Subject: [PATCH 105/262] Refactoring
extract the code to set this.mouseRect to rememberMousePosition
---
app/src/ui/lib/tooltip.tsx | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/app/src/ui/lib/tooltip.tsx b/app/src/ui/lib/tooltip.tsx
index 5d47f02ae4..1f65055187 100644
--- a/app/src/ui/lib/tooltip.tsx
+++ b/app/src/ui/lib/tooltip.tsx
@@ -299,8 +299,12 @@ export class Tooltip extends React.Component<
}
}
- private onTargetMouseEnter = (event: MouseEvent) => {
+ private rememberMousePosition = (event: MouseEvent) => {
this.mouseRect = new DOMRect(event.clientX - 10, event.clientY - 10, 20, 20)
+ }
+
+ private onTargetMouseEnter = (event: MouseEvent) => {
+ this.rememberMousePosition(event)
this.mouseOverTarget = true
this.cancelHideTooltip()
@@ -310,7 +314,7 @@ export class Tooltip extends React.Component<
}
private onTargetMouseMove = (event: MouseEvent) => {
- this.mouseRect = new DOMRect(event.clientX - 10, event.clientY - 10, 20, 20)
+ this.rememberMousePosition(event)
}
private onTargetMouseDown = (event: MouseEvent) => {
From afc2fac6255217adad816972412c2198d3b32718 Mon Sep 17 00:00:00 2001
From: Angus
Date: Mon, 17 Oct 2022 18:29:44 +0100
Subject: [PATCH 106/262] Fix menu items are disabled if close the rebase
conflict dialog
onDismissed didn't reset IAppState. currentPopup so the menu is disabled.
Need to call closePopup in onInvokeConflictsDialogDismissed
"Abort Rebase" works properly since it calls onFlowEnded()
---
.../ui/multi-commit-operation/base-multi-commit-operation.tsx | 2 ++
1 file changed, 2 insertions(+)
diff --git a/app/src/ui/multi-commit-operation/base-multi-commit-operation.tsx b/app/src/ui/multi-commit-operation/base-multi-commit-operation.tsx
index aed59470f6..e3266ea7fe 100644
--- a/app/src/ui/multi-commit-operation/base-multi-commit-operation.tsx
+++ b/app/src/ui/multi-commit-operation/base-multi-commit-operation.tsx
@@ -93,6 +93,8 @@ export abstract class BaseMultiCommitOperation extends React.Component{targetBranch.name} : null}
>
)
+
+ this.props.dispatcher.closePopup(PopupType.MultiCommitOperation)
return dispatcher.onConflictsFoundBanner(
repository,
operationDescription,
From 1315f8cc67b140b19c6c7bb75aa309d1ace9b516 Mon Sep 17 00:00:00 2001
From: Angus
Date: Mon, 17 Oct 2022 22:35:24 +0100
Subject: [PATCH 107/262] Use text color for repository change indicator when
selected and with focus
---
app/styles/ui/_repository-list.scss | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/app/styles/ui/_repository-list.scss b/app/styles/ui/_repository-list.scss
index 044b1b8aa3..6adfa2d5b6 100644
--- a/app/styles/ui/_repository-list.scss
+++ b/app/styles/ui/_repository-list.scss
@@ -193,6 +193,12 @@
background: var(--list-item-selected-active-badge-background-color);
color: var(--list-item-selected-active-badge-color);
}
+
+ .change-indicator-wrapper {
+ .octicon {
+ color: var(--text-color);
+ }
+ }
}
}
From eddd8b9f5a579c3f969fb3b485cd9b1139ad1326 Mon Sep 17 00:00:00 2001
From: Angus
Date: Tue, 18 Oct 2022 07:32:49 +0100
Subject: [PATCH 108/262] Update function name to updateMouseRect
---
app/src/ui/lib/tooltip.tsx | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/app/src/ui/lib/tooltip.tsx b/app/src/ui/lib/tooltip.tsx
index 1f65055187..a724608423 100644
--- a/app/src/ui/lib/tooltip.tsx
+++ b/app/src/ui/lib/tooltip.tsx
@@ -299,12 +299,12 @@ export class Tooltip extends React.Component<
}
}
- private rememberMousePosition = (event: MouseEvent) => {
+ private updateMouseRect = (event: MouseEvent) => {
this.mouseRect = new DOMRect(event.clientX - 10, event.clientY - 10, 20, 20)
}
private onTargetMouseEnter = (event: MouseEvent) => {
- this.rememberMousePosition(event)
+ this.updateMouseRect(event)
this.mouseOverTarget = true
this.cancelHideTooltip()
@@ -314,7 +314,7 @@ export class Tooltip extends React.Component<
}
private onTargetMouseMove = (event: MouseEvent) => {
- this.rememberMousePosition(event)
+ this.updateMouseRect(event)
}
private onTargetMouseDown = (event: MouseEvent) => {
From 2a2ad0fcf4d0cdd116dd6ed3506ae787bf3624b6 Mon Sep 17 00:00:00 2001
From: Markus Olsson
Date: Tue, 18 Oct 2022 19:48:43 +0200
Subject: [PATCH 109/262] Update dugite to 2.1.0
This will get us Git v2.35.5
---
app/package.json | 2 +-
app/yarn.lock | 8 ++++----
2 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/app/package.json b/app/package.json
index 9273708c62..adc12afd2d 100644
--- a/app/package.json
+++ b/app/package.json
@@ -30,7 +30,7 @@
"desktop-trampoline": "desktop/desktop-trampoline#v0.9.8",
"dexie": "^3.2.2",
"dompurify": "^2.3.3",
- "dugite": "^2.0.0",
+ "dugite": "^2.1.0",
"electron-window-state": "^5.0.3",
"event-kit": "^2.0.0",
"focus-trap-react": "^8.1.0",
diff --git a/app/yarn.lock b/app/yarn.lock
index fe461f8a78..4458395bd4 100644
--- a/app/yarn.lock
+++ b/app/yarn.lock
@@ -387,10 +387,10 @@ dompurify@^2.3.3:
resolved "https://registry.yarnpkg.com/dompurify/-/dompurify-2.3.3.tgz#c1af3eb88be47324432964d8abc75cf4b98d634c"
integrity sha512-dqnqRkPMAjOZE0FogZ+ceJNM2dZ3V/yNOuFB7+39qpO93hHhfRpHw3heYQC7DPK9FqbQTfBKUJhiSfz4MvXYwg==
-dugite@^2.0.0:
- version "2.0.0"
- resolved "https://registry.yarnpkg.com/dugite/-/dugite-2.0.0.tgz#de0ef29b58caa863e25fecd318e99a0e6b05420b"
- integrity sha512-0+1imU6NGzcvf42DDBMywZDyPBTNxKaG4IupDKfQbWU8S5fI+J3UVAQOrF0MNzGQYqv9G80Oz/LcS5043z05WQ==
+dugite@^2.1.0:
+ version "2.1.0"
+ resolved "https://registry.yarnpkg.com/dugite/-/dugite-2.1.0.tgz#6f50c2244e57aaac2f36440aa7289815c73a688c"
+ integrity sha512-4l4jJz5zC6Q+/8doQNQZ9Ss3rmnO/JCHfOmQO+zGv+TIOUXimzfS02RvUOuFpEhZuaFTeFBSuK6ll/02TX3SxA==
dependencies:
progress "^2.0.3"
tar "^6.1.11"
From fbedef2bf17831ba0e1719970c32554bf5c0d6a1 Mon Sep 17 00:00:00 2001
From: Markus Olsson
Date: Tue, 18 Oct 2022 19:55:23 +0200
Subject: [PATCH 110/262] Changelog and package version bump
---
app/package.json | 2 +-
changelog.json | 1 +
2 files changed, 2 insertions(+), 1 deletion(-)
diff --git a/app/package.json b/app/package.json
index adc12afd2d..ec02226408 100644
--- a/app/package.json
+++ b/app/package.json
@@ -3,7 +3,7 @@
"productName": "GitHub Desktop",
"bundleID": "com.github.GitHubClient",
"companyName": "GitHub, Inc.",
- "version": "3.1.2-beta1",
+ "version": "3.1.3-beta1",
"main": "./main.js",
"repository": {
"type": "git",
diff --git a/changelog.json b/changelog.json
index 4a57665760..806710fff4 100644
--- a/changelog.json
+++ b/changelog.json
@@ -1,5 +1,6 @@
{
"releases": {
+ "3.1.3-beta1": ["[Improved] Upgrade embedded Git to 2.35.5"],
"3.1.2-beta1": [
"[Added] You can preview the changes a pull request from your current branch would make - #11517",
"[Fixed] App correctly remembers undo commit prompt setting - #15408",
From 11870edb893020628fc3b59a95ef96970cc68d73 Mon Sep 17 00:00:00 2001
From: Markus Olsson
Date: Tue, 18 Oct 2022 20:35:17 +0200
Subject: [PATCH 111/262] Revert file transport setting
---
app/test/unit/git/rev-parse-test.ts | 11 ++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)
diff --git a/app/test/unit/git/rev-parse-test.ts b/app/test/unit/git/rev-parse-test.ts
index a666dc7c7b..5e2c1b6428 100644
--- a/app/test/unit/git/rev-parse-test.ts
+++ b/app/test/unit/git/rev-parse-test.ts
@@ -57,7 +57,16 @@ describe('git/rev-parse', () => {
secondRepoPath,
''
)
- await git(['submodule', 'add', '../repo2'], firstRepoPath, '')
+
+ await git(
+ [
+ // Git 2.38 (backported into 2.35.5) changed the default here to 'user'
+ ...['-c', 'protocol.file.allow=always'],
+ ...['submodule', 'add', '../repo2'],
+ ],
+ firstRepoPath,
+ ''
+ )
expect(await getRepositoryType(firstRepoPath)).toMatchObject({
kind: 'regular',
From eeec2730468db2adb14256bca01002c7532dc963 Mon Sep 17 00:00:00 2001
From: Sergio Padrino
Date: Wed, 19 Oct 2022 12:17:31 +0200
Subject: [PATCH 112/262] Check if notification matches current repository
---
app/src/lib/stores/notifications-store.ts | 35 +++++++++++++++++++++++
1 file changed, 35 insertions(+)
diff --git a/app/src/lib/stores/notifications-store.ts b/app/src/lib/stores/notifications-store.ts
index e88b6922c4..30f611b0a7 100644
--- a/app/src/lib/stores/notifications-store.ts
+++ b/app/src/lib/stores/notifications-store.ts
@@ -2,7 +2,9 @@ import {
Repository,
isRepositoryWithGitHubRepository,
RepositoryWithGitHubRepository,
+ isRepositoryWithForkedGitHubRepository,
} from '../../models/repository'
+import { ForkContributionTarget } from '../../models/workflow-preferences'
import { PullRequest } from '../../models/pull-request'
import { API, APICheckConclusion } from '../api'
import {
@@ -121,6 +123,10 @@ export class NotificationsStore {
return
}
+ if (!this.isValidRepositoryForEvent(repository, event)) {
+ return
+ }
+
const pullRequests = await this.pullRequestCoordinator.getAllPullRequests(
repository
)
@@ -192,6 +198,10 @@ export class NotificationsStore {
return
}
+ if (!this.isValidRepositoryForEvent(repository, event)) {
+ return
+ }
+
const pullRequests = await this.pullRequestCoordinator.getAllPullRequests(
repository
)
@@ -283,6 +293,31 @@ export class NotificationsStore {
this.statsStore.recordChecksFailedNotificationShown()
}
+ private isValidRepositoryForEvent(
+ repository: RepositoryWithGitHubRepository,
+ event: DesktopAliveEvent
+ ) {
+ // If it's a fork and set to contribute to the parent repository, try to
+ // match the parent repository.
+ if (
+ isRepositoryWithForkedGitHubRepository(repository) &&
+ repository.workflowPreferences.forkContributionTarget ===
+ ForkContributionTarget.Parent
+ ) {
+ const parentRepository = repository.gitHubRepository.parent
+ return (
+ parentRepository.owner.login === event.owner &&
+ parentRepository.name === event.repo
+ )
+ }
+
+ const ghRepository = repository.gitHubRepository
+ return (
+ ghRepository.owner.login === event.owner &&
+ ghRepository.name === event.repo
+ )
+ }
+
/**
* Makes the store to keep track of the currently selected repository. Only
* notifications for the currently selected repository will be shown.
From 8f0c5895084a681d19c3b834800d5c94ae3b332b Mon Sep 17 00:00:00 2001
From: Daniel Ciaglia
Date: Thu, 20 Oct 2022 12:14:13 +0200
Subject: [PATCH 113/262] satisfy prettier
---
app/src/lib/editors/darwin.ts | 5 +----
1 file changed, 1 insertion(+), 4 deletions(-)
diff --git a/app/src/lib/editors/darwin.ts b/app/src/lib/editors/darwin.ts
index 4376efb1a2..b9690c82c5 100644
--- a/app/src/lib/editors/darwin.ts
+++ b/app/src/lib/editors/darwin.ts
@@ -45,10 +45,7 @@ const editors: IDarwinExternalEditor[] = [
},
{
name: 'VSCodium',
- bundleIdentifiers: [
- 'com.visualstudio.code.oss',
- 'com.vscodium',
- ],
+ bundleIdentifiers: ['com.visualstudio.code.oss', 'com.vscodium'],
},
{
name: 'Sublime Text',
From ba0cbcde3efc5df08675378402cf767f3361b1d8 Mon Sep 17 00:00:00 2001
From: tidy-dev <75402236+tidy-dev@users.noreply.github.com>
Date: Tue, 18 Oct 2022 13:08:15 -0400
Subject: [PATCH 114/262] Extensify popups to add id's
---
app/src/models/popup.ts | 743 +++++++++++++++++++++++++---------------
1 file changed, 461 insertions(+), 282 deletions(-)
diff --git a/app/src/models/popup.ts b/app/src/models/popup.ts
index 57cc87c866..cae0aba9ec 100644
--- a/app/src/models/popup.ts
+++ b/app/src/models/popup.ts
@@ -89,286 +89,465 @@ export enum PopupType {
StartPullRequest,
}
+interface IBasePopup {
+ /**
+ * Unique id of the popup that it receives upon adding to the stack.
+ */
+ readonly id?: string
+}
+
+interface IRenameBranchPopup extends IBasePopup {
+ type: PopupType.RenameBranch
+ repository: Repository
+ branch: Branch
+}
+
+interface IDeleteBranchPopup extends IBasePopup {
+ type: PopupType.DeleteBranch
+ repository: Repository
+ branch: Branch
+ existsOnRemote: boolean
+}
+
+interface IDeleteRemoteBranchPopup extends IBasePopup {
+ type: PopupType.DeleteRemoteBranch
+ repository: Repository
+ branch: Branch
+}
+
+interface IConfirmDiscardChangesPopup extends IBasePopup {
+ type: PopupType.ConfirmDiscardChanges
+ repository: Repository
+ files: ReadonlyArray
+ showDiscardChangesSetting?: boolean
+ discardingAllChanges?: boolean
+}
+
+interface IConfirmDiscardSelectionPopup extends IBasePopup {
+ type: PopupType.ConfirmDiscardSelection
+ repository: Repository
+ file: WorkingDirectoryFileChange
+ diff: ITextDiff
+ selection: DiffSelection
+}
+
+interface IPreferencesPopup extends IBasePopup {
+ type: PopupType.Preferences
+ initialSelectedTab?: PreferencesTab
+}
+
+interface IRepositorySettingsPopup extends IBasePopup {
+ type: PopupType.RepositorySettings
+ repository: Repository
+ initialSelectedTab?: RepositorySettingsTab
+}
+
+interface IAddRepositoryPopup extends IBasePopup {
+ type: PopupType.AddRepository
+ path?: string
+}
+
+interface ICreateRepositoryPopup extends IBasePopup {
+ type: PopupType.CreateRepository
+ path?: string
+}
+
+interface ICloneRepositoryPopup extends IBasePopup {
+ type: PopupType.CloneRepository
+ initialURL: string | null
+}
+
+interface ICreateBranchPopup extends IBasePopup {
+ type: PopupType.CreateBranch
+ repository: Repository
+ initialName?: string
+ targetCommit?: CommitOneLine
+}
+
+interface ISignInPopup extends IBasePopup {
+ type: PopupType.SignIn
+}
+
+interface IAboutPopup extends IBasePopup {
+ type: PopupType.About
+}
+
+interface IInstallGitPopup extends IBasePopup {
+ type: PopupType.InstallGit
+ path: string
+}
+
+interface IPublishRepositoryPopup extends IBasePopup {
+ type: PopupType.PublishRepository
+ repository: Repository
+}
+
+interface IAcknowledgementsPopup extends IBasePopup {
+ type: PopupType.Acknowledgements
+}
+
+interface IUntrustedCertificatePopup extends IBasePopup {
+ type: PopupType.UntrustedCertificate
+ certificate: Electron.Certificate
+ url: string
+}
+
+interface IRemoveRepositoryPopup extends IBasePopup {
+ type: PopupType.RemoveRepository
+ repository: Repository
+}
+
+interface ITermsAndConditionsPopup extends IBasePopup {
+ type: PopupType.TermsAndConditions
+}
+
+interface IPushBranchCommitsPopup extends IBasePopup {
+ type: PopupType.PushBranchCommits
+ repository: Repository
+ branch: Branch
+ unPushedCommits?: number
+}
+
+interface ICLIInstalledPopup extends IBasePopup {
+ type: PopupType.CLIInstalled
+}
+
+interface IGenericGitAuthenticationPopup extends IBasePopup {
+ type: PopupType.GenericGitAuthentication
+ hostname: string
+ retryAction: RetryAction
+}
+
+interface IExternalEditorFailedPopup extends IBasePopup {
+ type: PopupType.ExternalEditorFailed
+ message: string
+ suggestDefaultEditor?: boolean
+ openPreferences?: boolean
+}
+
+interface IOpenShellFailedPopup extends IBasePopup {
+ type: PopupType.OpenShellFailed
+ message: string
+}
+
+interface IInitializeLFSPopup extends IBasePopup {
+ type: PopupType.InitializeLFS
+ repositories: ReadonlyArray
+}
+
+interface ILFSAttributeMismatchPopup extends IBasePopup {
+ type: PopupType.LFSAttributeMismatch
+}
+
+interface IUpstreamAlreadyExistsPopup extends IBasePopup {
+ type: PopupType.UpstreamAlreadyExists
+ repository: Repository
+ existingRemote: IRemote
+}
+
+interface IReleaseNotesPopup extends IBasePopup {
+ type: PopupType.ReleaseNotes
+ newReleases: ReadonlyArray
+}
+
+interface IDeletePullRequestPopup extends IBasePopup {
+ type: PopupType.DeletePullRequest
+ repository: Repository
+ branch: Branch
+ pullRequest: PullRequest
+}
+
+interface IOversizedFilesPopup extends IBasePopup {
+ type: PopupType.OversizedFiles
+ oversizedFiles: ReadonlyArray
+ context: ICommitContext
+ repository: Repository
+}
+
+interface ICommitConflictsWarningPopup extends IBasePopup {
+ type: PopupType.CommitConflictsWarning
+ /** files that were selected for committing that are also conflicted */
+ files: ReadonlyArray
+ /** repository user is committing in */
+ repository: Repository
+ /** information for completing the commit */
+ context: ICommitContext
+}
+
+interface IPushNeedsPullPopup extends IBasePopup {
+ type: PopupType.PushNeedsPull
+ repository: Repository
+}
+
+interface IConfirmForcePushPopup extends IBasePopup {
+ type: PopupType.ConfirmForcePush
+ repository: Repository
+ upstreamBranch: string
+}
+
+interface IStashAndSwitchBranchPopup extends IBasePopup {
+ type: PopupType.StashAndSwitchBranch
+ repository: Repository
+ branchToCheckout: Branch
+}
+
+interface IConfirmOverwriteStashPopup extends IBasePopup {
+ type: PopupType.ConfirmOverwriteStash
+ repository: Repository
+ branchToCheckout: Branch | null
+}
+
+interface IConfirmDiscardStashPopup extends IBasePopup {
+ type: PopupType.ConfirmDiscardStash
+ repository: Repository
+ stash: IStashEntry
+}
+
+interface ICreateTutorialRepositoryPopup extends IBasePopup {
+ type: PopupType.CreateTutorialRepository
+ account: Account
+ progress?: Progress
+}
+
+interface IConfirmExitTutorialPopup extends IBasePopup {
+ type: PopupType.ConfirmExitTutorial
+}
+
+interface IPushRejectedDueToMissingWorkflowScopePopup extends IBasePopup {
+ type: PopupType.PushRejectedDueToMissingWorkflowScope
+ rejectedPath: string
+ repository: RepositoryWithGitHubRepository
+}
+
+interface ISAMLReauthRequiredPopup extends IBasePopup {
+ type: PopupType.SAMLReauthRequired
+ organizationName: string
+ endpoint: string
+ retryAction?: RetryAction
+}
+
+interface ICreateForkPopup extends IBasePopup {
+ type: PopupType.CreateFork
+ repository: RepositoryWithGitHubRepository
+ account: Account
+}
+
+interface ICreateTagPopup extends IBasePopup {
+ type: PopupType.CreateTag
+ repository: Repository
+ targetCommitSha: string
+ initialName?: string
+ localTags: Map | null
+}
+
+interface IDeleteTagPopup extends IBasePopup {
+ type: PopupType.DeleteTag
+ repository: Repository
+ tagName: string
+}
+
+interface IChooseForkSettingsPopup extends IBasePopup {
+ type: PopupType.ChooseForkSettings
+ repository: RepositoryWithForkedGitHubRepository
+}
+
+interface ILocalChangesOverwrittenPopup extends IBasePopup {
+ type: PopupType.LocalChangesOverwritten
+ repository: Repository
+ retryAction: RetryAction
+ files: ReadonlyArray
+}
+
+interface IMoveToApplicationsFolderPopup extends IBasePopup {
+ type: PopupType.MoveToApplicationsFolder
+}
+
+interface IChangeRepositoryAliasPopup extends IBasePopup {
+ type: PopupType.ChangeRepositoryAlias
+ repository: Repository
+}
+
+interface IThankYouPopup extends IBasePopup {
+ type: PopupType.ThankYou
+ userContributions: ReadonlyArray
+ friendlyName: string
+ latestVersion: string | null
+}
+
+interface ICommitMessagePopup extends IBasePopup {
+ type: PopupType.CommitMessage
+ coAuthors: ReadonlyArray
+ showCoAuthoredBy: boolean
+ commitMessage: ICommitMessage | null
+ dialogTitle: string
+ dialogButtonText: string
+ prepopulateCommitSummary: boolean
+ repository: Repository
+ onSubmitCommitMessage: (context: ICommitContext) => Promise
+}
+
+interface IMultiCommitOperationPopup extends IBasePopup {
+ type: PopupType.MultiCommitOperation
+ repository: Repository
+}
+
+interface IWarnLocalChangesBeforeUndoPopup extends IBasePopup {
+ type: PopupType.WarnLocalChangesBeforeUndo
+ repository: Repository
+ commit: Commit
+ isWorkingDirectoryClean: boolean
+}
+
+interface IWarningBeforeResetPopup extends IBasePopup {
+ type: PopupType.WarningBeforeReset
+ repository: Repository
+ commit: Commit
+}
+
+interface IInvalidatedTokenPopup extends IBasePopup {
+ type: PopupType.InvalidatedToken
+ account: Account
+}
+
+interface IAddSSHHostPopup extends IBasePopup {
+ type: PopupType.AddSSHHost
+ host: string
+ ip: string
+ keyType: string
+ fingerprint: string
+ onSubmit: (addHost: boolean) => void
+}
+
+interface ISSHKeyPassphrasePopup extends IBasePopup {
+ type: PopupType.SSHKeyPassphrase
+ keyPath: string
+ onSubmit: (passphrase: string | undefined, storePassphrase: boolean) => void
+}
+
+interface ISSHUserPasswordPopup extends IBasePopup {
+ type: PopupType.SSHUserPassword
+ username: string
+ onSubmit: (password: string | undefined, storePassword: boolean) => void
+}
+
+interface IPullRequestChecksFailedPopup extends IBasePopup {
+ type: PopupType.PullRequestChecksFailed
+ repository: RepositoryWithGitHubRepository
+ pullRequest: PullRequest
+ shouldChangeRepository: boolean
+ commitMessage: string
+ commitSha: string
+ checks: ReadonlyArray
+}
+
+interface ICICheckRunRerunPopup extends IBasePopup {
+ type: PopupType.CICheckRunRerun
+ checkRuns: ReadonlyArray
+ repository: GitHubRepository
+ prRef: string
+ failedOnly: boolean
+}
+
+interface IWarnForcePushPopup extends IBasePopup {
+ type: PopupType.WarnForcePush
+ operation: string
+ onBegin: () => void
+}
+
+interface IDiscardChangesRetryPopup extends IBasePopup {
+ type: PopupType.DiscardChangesRetry
+ retryAction: RetryAction
+}
+
+interface IPullRequestReviewPopup extends IBasePopup {
+ type: PopupType.PullRequestReview
+ repository: RepositoryWithGitHubRepository
+ pullRequest: PullRequest
+ review: ValidNotificationPullRequestReview
+ numberOfComments: number
+ shouldCheckoutBranch: boolean
+ shouldChangeRepository: boolean
+}
+
+interface IUnreachableCommitsPopup extends IBasePopup {
+ type: PopupType.UnreachableCommits
+ selectedTab: UnreachableCommitsTab
+}
+
+interface IStartPullRequestPopup extends IBasePopup {
+ type: PopupType.StartPullRequest
+ allBranches: ReadonlyArray
+ currentBranch: Branch
+ defaultBranch: Branch | null
+ externalEditorLabel?: string
+ imageDiffType: ImageDiffType
+ recentBranches: ReadonlyArray
+ repository: Repository
+ nonLocalCommitSHA: string | null
+ showSideBySideDiff: boolean
+}
+
export type Popup =
- | { type: PopupType.RenameBranch; repository: Repository; branch: Branch }
- | {
- type: PopupType.DeleteBranch
- repository: Repository
- branch: Branch
- existsOnRemote: boolean
- }
- | {
- type: PopupType.DeleteRemoteBranch
- repository: Repository
- branch: Branch
- }
- | {
- type: PopupType.ConfirmDiscardChanges
- repository: Repository
- files: ReadonlyArray
- showDiscardChangesSetting?: boolean
- discardingAllChanges?: boolean
- }
- | {
- type: PopupType.ConfirmDiscardSelection
- repository: Repository
- file: WorkingDirectoryFileChange
- diff: ITextDiff
- selection: DiffSelection
- }
- | { type: PopupType.Preferences; initialSelectedTab?: PreferencesTab }
- | {
- type: PopupType.RepositorySettings
- repository: Repository
- initialSelectedTab?: RepositorySettingsTab
- }
- | { type: PopupType.AddRepository; path?: string }
- | { type: PopupType.CreateRepository; path?: string }
- | {
- type: PopupType.CloneRepository
- initialURL: string | null
- }
- | {
- type: PopupType.CreateBranch
- repository: Repository
- initialName?: string
- targetCommit?: CommitOneLine
- }
- | { type: PopupType.SignIn }
- | { type: PopupType.About }
- | { type: PopupType.InstallGit; path: string }
- | { type: PopupType.PublishRepository; repository: Repository }
- | { type: PopupType.Acknowledgements }
- | {
- type: PopupType.UntrustedCertificate
- certificate: Electron.Certificate
- url: string
- }
- | { type: PopupType.RemoveRepository; repository: Repository }
- | { type: PopupType.TermsAndConditions }
- | {
- type: PopupType.PushBranchCommits
- repository: Repository
- branch: Branch
- unPushedCommits?: number
- }
- | { type: PopupType.CLIInstalled }
- | {
- type: PopupType.GenericGitAuthentication
- hostname: string
- retryAction: RetryAction
- }
- | {
- type: PopupType.ExternalEditorFailed
- message: string
- suggestDefaultEditor?: boolean
- openPreferences?: boolean
- }
- | { type: PopupType.OpenShellFailed; message: string }
- | { type: PopupType.InitializeLFS; repositories: ReadonlyArray }
- | { type: PopupType.LFSAttributeMismatch }
- | {
- type: PopupType.UpstreamAlreadyExists
- repository: Repository
- existingRemote: IRemote
- }
- | {
- type: PopupType.ReleaseNotes
- newReleases: ReadonlyArray
- }
- | {
- type: PopupType.DeletePullRequest
- repository: Repository
- branch: Branch
- pullRequest: PullRequest
- }
- | {
- type: PopupType.OversizedFiles
- oversizedFiles: ReadonlyArray
- context: ICommitContext
- repository: Repository
- }
- | {
- type: PopupType.CommitConflictsWarning
- /** files that were selected for committing that are also conflicted */
- files: ReadonlyArray
- /** repository user is committing in */
- repository: Repository
- /** information for completing the commit */
- context: ICommitContext
- }
- | {
- type: PopupType.PushNeedsPull
- repository: Repository
- }
- | {
- type: PopupType.ConfirmForcePush
- repository: Repository
- upstreamBranch: string
- }
- | {
- type: PopupType.StashAndSwitchBranch
- repository: Repository
- branchToCheckout: Branch
- }
- | {
- type: PopupType.ConfirmOverwriteStash
- repository: Repository
- branchToCheckout: Branch | null
- }
- | {
- type: PopupType.ConfirmDiscardStash
- repository: Repository
- stash: IStashEntry
- }
- | {
- type: PopupType.CreateTutorialRepository
- account: Account
- progress?: Progress
- }
- | {
- type: PopupType.ConfirmExitTutorial
- }
- | {
- type: PopupType.PushRejectedDueToMissingWorkflowScope
- rejectedPath: string
- repository: RepositoryWithGitHubRepository
- }
- | {
- type: PopupType.SAMLReauthRequired
- organizationName: string
- endpoint: string
- retryAction?: RetryAction
- }
- | {
- type: PopupType.CreateFork
- repository: RepositoryWithGitHubRepository
- account: Account
- }
- | {
- type: PopupType.CreateTag
- repository: Repository
- targetCommitSha: string
- initialName?: string
- localTags: Map | null
- }
- | {
- type: PopupType.DeleteTag
- repository: Repository
- tagName: string
- }
- | {
- type: PopupType.ChooseForkSettings
- repository: RepositoryWithForkedGitHubRepository
- }
- | {
- type: PopupType.LocalChangesOverwritten
- repository: Repository
- retryAction: RetryAction
- files: ReadonlyArray
- }
- | { type: PopupType.MoveToApplicationsFolder }
- | { type: PopupType.ChangeRepositoryAlias; repository: Repository }
- | {
- type: PopupType.ThankYou
- userContributions: ReadonlyArray
- friendlyName: string
- latestVersion: string | null
- }
- | {
- type: PopupType.CommitMessage
- coAuthors: ReadonlyArray
- showCoAuthoredBy: boolean
- commitMessage: ICommitMessage | null
- dialogTitle: string
- dialogButtonText: string
- prepopulateCommitSummary: boolean
- repository: Repository
- onSubmitCommitMessage: (context: ICommitContext) => Promise
- }
- | {
- type: PopupType.MultiCommitOperation
- repository: Repository
- }
- | {
- type: PopupType.WarnLocalChangesBeforeUndo
- repository: Repository
- commit: Commit
- isWorkingDirectoryClean: boolean
- }
- | {
- type: PopupType.WarningBeforeReset
- repository: Repository
- commit: Commit
- }
- | {
- type: PopupType.InvalidatedToken
- account: Account
- }
- | {
- type: PopupType.AddSSHHost
- host: string
- ip: string
- keyType: string
- fingerprint: string
- onSubmit: (addHost: boolean) => void
- }
- | {
- type: PopupType.SSHKeyPassphrase
- keyPath: string
- onSubmit: (
- passphrase: string | undefined,
- storePassphrase: boolean
- ) => void
- }
- | {
- type: PopupType.SSHUserPassword
- username: string
- onSubmit: (password: string | undefined, storePassword: boolean) => void
- }
- | {
- type: PopupType.PullRequestChecksFailed
- repository: RepositoryWithGitHubRepository
- pullRequest: PullRequest
- shouldChangeRepository: boolean
- commitMessage: string
- commitSha: string
- checks: ReadonlyArray
- }
- | {
- type: PopupType.CICheckRunRerun
- checkRuns: ReadonlyArray
- repository: GitHubRepository
- prRef: string
- failedOnly: boolean
- }
- | { type: PopupType.WarnForcePush; operation: string; onBegin: () => void }
- | {
- type: PopupType.DiscardChangesRetry
- retryAction: RetryAction
- }
- | {
- type: PopupType.PullRequestReview
- repository: RepositoryWithGitHubRepository
- pullRequest: PullRequest
- review: ValidNotificationPullRequestReview
- numberOfComments: number
- shouldCheckoutBranch: boolean
- shouldChangeRepository: boolean
- }
- | {
- type: PopupType.UnreachableCommits
- selectedTab: UnreachableCommitsTab
- }
- | {
- type: PopupType.StartPullRequest
- allBranches: ReadonlyArray
- currentBranch: Branch
- defaultBranch: Branch | null
- externalEditorLabel?: string
- imageDiffType: ImageDiffType
- recentBranches: ReadonlyArray
- repository: Repository
- nonLocalCommitSHA: string | null
- showSideBySideDiff: boolean
- }
+ | IRenameBranchPopup
+ | IDeleteBranchPopup
+ | IDeleteRemoteBranchPopup
+ | IConfirmDiscardChangesPopup
+ | IConfirmDiscardSelectionPopup
+ | IPreferencesPopup
+ | IRepositorySettingsPopup
+ | IAddRepositoryPopup
+ | ICreateRepositoryPopup
+ | ICloneRepositoryPopup
+ | ICreateBranchPopup
+ | ISignInPopup
+ | IAboutPopup
+ | IInstallGitPopup
+ | IPublishRepositoryPopup
+ | IAcknowledgementsPopup
+ | IUntrustedCertificatePopup
+ | IRemoveRepositoryPopup
+ | ITermsAndConditionsPopup
+ | IPushBranchCommitsPopup
+ | ICLIInstalledPopup
+ | IGenericGitAuthenticationPopup
+ | IExternalEditorFailedPopup
+ | IOpenShellFailedPopup
+ | IInitializeLFSPopup
+ | ILFSAttributeMismatchPopup
+ | IUpstreamAlreadyExistsPopup
+ | IReleaseNotesPopup
+ | IDeletePullRequestPopup
+ | IOversizedFilesPopup
+ | ICommitConflictsWarningPopup
+ | IPushNeedsPullPopup
+ | IConfirmForcePushPopup
+ | IStashAndSwitchBranchPopup
+ | IConfirmOverwriteStashPopup
+ | IConfirmDiscardStashPopup
+ | ICreateTutorialRepositoryPopup
+ | IConfirmExitTutorialPopup
+ | IPushRejectedDueToMissingWorkflowScopePopup
+ | ISAMLReauthRequiredPopup
+ | ICreateForkPopup
+ | ICreateTagPopup
+ | IDeleteTagPopup
+ | IChooseForkSettingsPopup
+ | ILocalChangesOverwrittenPopup
+ | IMoveToApplicationsFolderPopup
+ | IChangeRepositoryAliasPopup
+ | IThankYouPopup
+ | ICommitMessagePopup
+ | IMultiCommitOperationPopup
+ | IWarnLocalChangesBeforeUndoPopup
+ | IWarningBeforeResetPopup
+ | IInvalidatedTokenPopup
+ | IAddSSHHostPopup
+ | ISSHKeyPassphrasePopup
+ | ISSHUserPasswordPopup
+ | IPullRequestChecksFailedPopup
+ | ICICheckRunRerunPopup
+ | IWarnForcePushPopup
+ | IDiscardChangesRetryPopup
+ | IPullRequestReviewPopup
+ | IUnreachableCommitsPopup
+ | IStartPullRequestPopup
From 814cc5b5af6e9ff7585a263f0e8ac2efa5e21eb0 Mon Sep 17 00:00:00 2001
From: tidy-dev <75402236+tidy-dev@users.noreply.github.com>
Date: Tue, 18 Oct 2022 13:08:31 -0400
Subject: [PATCH 115/262] Create a popup manager
---
app/src/lib/popup-manager.ts | 65 ++++++++++++++++++++++++++++++++++++
1 file changed, 65 insertions(+)
create mode 100644 app/src/lib/popup-manager.ts
diff --git a/app/src/lib/popup-manager.ts b/app/src/lib/popup-manager.ts
new file mode 100644
index 0000000000..8202cc073f
--- /dev/null
+++ b/app/src/lib/popup-manager.ts
@@ -0,0 +1,65 @@
+import { Popup, PopupType } from '../models/popup'
+import { getObjectId } from '../ui/lib/object-id'
+
+/**
+ * The popup manager is to manage the stack of currently open popups.
+ */
+export class PopupManager {
+ private popupStack = new Array()
+
+ public get currentPopup(): Popup | undefined {
+ return this.popupStack.at(-1)
+ }
+
+ public get isAPopupOpen(): boolean {
+ return this.currentPopup !== undefined
+ }
+
+ public getPopupsOfType(popupType: PopupType): ReadonlyArray {
+ return [...this.popupStack.filter(p => p.type !== popupType)]
+ }
+
+ public isPopupsOfType(popupType: PopupType): boolean {
+ return this.popupStack.some(p => p.type === popupType)
+ }
+
+ public addPopup(popupToAdd: Popup): Popup {
+ const popup = { id: getObjectId(popupToAdd), ...popupToAdd }
+ this.popupStack.push(popup)
+ return popup
+ }
+
+ public updatePopup(popupToUpdate: Popup): Popup {
+ if (popupToUpdate.id === null) {
+ console.warn(`Attempted to update a popup without an id.`)
+ return popupToUpdate
+ }
+
+ const index = this.popupStack.findIndex(p => p.id === popupToUpdate.id)
+ if (index < 0) {
+ console.warn(`Attempted to update a popup not in the stack.`)
+ return popupToUpdate
+ }
+
+ this.popupStack = [
+ ...this.popupStack.slice(0, index),
+ popupToUpdate,
+ ...this.popupStack.slice(index + 1),
+ ]
+ return popupToUpdate
+ }
+
+ public removePopup(popup: Popup) {
+ if (popup.id === null) {
+ console.warn(`Attempted to remove a popup without an id.`)
+ return
+ }
+ this.popupStack = this.popupStack.filter(p => p.id !== popup.id)
+ }
+
+ public removePopupByType(popupType: PopupType) {
+ this.popupStack = this.popupStack.filter(p => p.type !== popupType)
+ }
+}
+
+export const popupManager = new PopupManager()
From 1109720cbf33442765d89875e13874aa70be77ef Mon Sep 17 00:00:00 2001
From: tidy-dev <75402236+tidy-dev@users.noreply.github.com>
Date: Wed, 19 Oct 2022 10:05:52 -0400
Subject: [PATCH 116/262] Use popup manager
---
app/src/lib/app-state.ts | 2 -
app/src/lib/menu-update.ts | 3 +-
app/src/lib/multi-commit-operation.ts | 7 ++--
app/src/lib/stores/app-store.ts | 60 ++++++++++++---------------
app/src/ui/app.tsx | 5 ++-
app/src/ui/index.tsx | 5 ++-
6 files changed, 38 insertions(+), 44 deletions(-)
diff --git a/app/src/lib/app-state.ts b/app/src/lib/app-state.ts
index 08ead91bc3..952da275d1 100644
--- a/app/src/lib/app-state.ts
+++ b/app/src/lib/app-state.ts
@@ -22,7 +22,6 @@ import {
ICloneProgress,
IMultiCommitOperationProgress,
} from '../models/progress'
-import { Popup } from '../models/popup'
import { SignInState } from './stores/sign-in-store'
@@ -115,7 +114,6 @@ export interface IAppState {
readonly showWelcomeFlow: boolean
readonly focusCommitMessage: boolean
- readonly currentPopup: Popup | null
readonly currentFoldout: Foldout | null
readonly currentBanner: Banner | null
diff --git a/app/src/lib/menu-update.ts b/app/src/lib/menu-update.ts
index 9f0c644679..c4825b0de1 100644
--- a/app/src/lib/menu-update.ts
+++ b/app/src/lib/menu-update.ts
@@ -11,6 +11,7 @@ import { updateMenuState as ipcUpdateMenuState } from '../ui/main-process-proxy'
import { AppMenu, MenuItem } from '../models/app-menu'
import { hasConflictedFiles } from './status'
import { findContributionTargetDefaultBranch } from './branch'
+import { popupManager } from './popup-manager'
export interface IMenuItemState {
readonly enabled?: boolean
@@ -363,7 +364,7 @@ function getRepositoryMenuBuilder(state: IAppState): MenuStateBuilder {
}
function getMenuState(state: IAppState): Map {
- if (state.currentPopup) {
+ if (popupManager.isAPopupOpen) {
return getAllMenusDisabledBuilder().state
}
diff --git a/app/src/lib/multi-commit-operation.ts b/app/src/lib/multi-commit-operation.ts
index 897c2909e2..8b88338126 100644
--- a/app/src/lib/multi-commit-operation.ts
+++ b/app/src/lib/multi-commit-operation.ts
@@ -4,9 +4,10 @@ import {
conflictSteps,
MultiCommitOperationStepKind,
} from '../models/multi-commit-operation'
-import { Popup, PopupType } from '../models/popup'
+import { PopupType } from '../models/popup'
import { TipState } from '../models/tip'
import { IMultiCommitOperationState, IRepositoryState } from './app-state'
+import { popupManager } from './popup-manager'
/**
* Setup the multi commit operation state when the user needs to select a branch as the
@@ -39,12 +40,10 @@ export function getMultiCommitOperationChooseBranchStep(
}
export function isConflictsFlow(
- currentPopup: Popup | null,
multiCommitOperationState: IMultiCommitOperationState | null
): boolean {
return (
- currentPopup !== null &&
- currentPopup.type === PopupType.MultiCommitOperation &&
+ popupManager.isPopupsOfType(PopupType.MultiCommitOperation) &&
multiCommitOperationState !== null &&
conflictSteps.includes(multiCommitOperationState.step.kind)
)
diff --git a/app/src/lib/stores/app-store.ts b/app/src/lib/stores/app-store.ts
index afed3ee5c9..4aae35489d 100644
--- a/app/src/lib/stores/app-store.ts
+++ b/app/src/lib/stores/app-store.ts
@@ -304,6 +304,7 @@ import { offsetFromNow } from '../offset-from'
import { findContributionTargetDefaultBranch } from '../branch'
import { ValidNotificationPullRequestReview } from '../valid-notification-pull-request-review'
import { determineMergeability } from '../git/merge-tree'
+import { popupManager } from '../popup-manager'
const LastSelectedRepositoryIDKey = 'last-selected-repository-id'
@@ -396,7 +397,6 @@ export class AppStore extends TypedBaseStore {
private showWelcomeFlow = false
private focusCommitMessage = false
- private currentPopup: Popup | null = null
private currentFoldout: Foldout | null = null
private currentBanner: Banner | null = null
private errors: ReadonlyArray = new Array()
@@ -639,7 +639,7 @@ export class AppStore extends TypedBaseStore {
// If there is a currently open popup, don't do anything here. Since the
// app can only show one popup at a time, we don't want to close the current
// one in favor of the error we're about to show.
- if (this.currentPopup !== null) {
+ if (popupManager.isAPopupOpen) {
return
}
@@ -904,7 +904,6 @@ export class AppStore extends TypedBaseStore {
appIsFocused: this.appIsFocused,
selectedState: this.getSelectedState(),
signInState: this.signInStore.getState(),
- currentPopup: this.currentPopup,
currentFoldout: this.currentFoldout,
errors: this.errors,
showWelcomeFlow: this.showWelcomeFlow,
@@ -2506,10 +2505,7 @@ export class AppStore extends TypedBaseStore {
this.currentBanner !== null &&
this.currentBanner.type === BannerType.ConflictsFound
- if (
- displayingBanner ||
- isConflictsFlow(this.currentPopup, multiCommitOperationState)
- ) {
+ if (displayingBanner || isConflictsFlow(multiCommitOperationState)) {
return
}
@@ -2596,12 +2592,7 @@ export class AppStore extends TypedBaseStore {
*/
private clearConflictsFlowVisuals(state: IRepositoryState) {
const { multiCommitOperationState } = state
- if (
- userIsStartingMultiCommitOperation(
- this.currentPopup,
- multiCommitOperationState
- )
- ) {
+ if (userIsStartingMultiCommitOperation(multiCommitOperationState)) {
return
}
@@ -3480,32 +3471,35 @@ export class AppStore extends TypedBaseStore {
/** This shouldn't be called directly. See `Dispatcher`. */
public async _showPopup(popup: Popup): Promise {
- this._closePopup()
-
// Always close the app menu when showing a pop up. This is only
// applicable on Windows where we draw a custom app menu.
this._closeFoldout(FoldoutType.AppMenu)
- this.currentPopup = popup
+ popupManager.addPopup(popup)
this.emitUpdate()
}
/** This shouldn't be called directly. See `Dispatcher`. */
public _closePopup(popupType?: PopupType) {
- const currentPopup = this.currentPopup
- if (currentPopup == null) {
+ const currentPopup = popupManager.currentPopup
+ if (currentPopup === undefined) {
return
}
- if (popupType !== undefined && currentPopup.type !== popupType) {
- return
+ if (popupType === undefined) {
+ popupManager.removePopup(currentPopup)
+ } else {
+ if (currentPopup.type !== popupType) {
+ return
+ }
+
+ if (currentPopup.type === PopupType.CloneRepository) {
+ this._completeOpenInDesktop(() => Promise.resolve(null))
+ }
+
+ popupManager.removePopupByType(popupType)
}
- if (currentPopup.type === PopupType.CloneRepository) {
- this._completeOpenInDesktop(() => Promise.resolve(null))
- }
-
- this.currentPopup = null
this.emitUpdate()
}
@@ -6497,13 +6491,14 @@ export class AppStore extends TypedBaseStore {
path,
(title, value, description) => {
if (
- this.currentPopup !== null &&
- this.currentPopup.type === PopupType.CreateTutorialRepository
+ popupManager.currentPopup !== undefined &&
+ popupManager.currentPopup.type ===
+ PopupType.CreateTutorialRepository
) {
- this.currentPopup = {
- ...this.currentPopup,
+ popupManager.updatePopup({
+ ...popupManager.currentPopup,
progress: { kind: 'generic', title, value, description },
- }
+ })
this.emitUpdate()
}
}
@@ -7488,14 +7483,13 @@ function getInitialAction(
}
function userIsStartingMultiCommitOperation(
- currentPopup: Popup | null,
state: IMultiCommitOperationState | null
) {
- if (currentPopup === null || state === null) {
+ if (!popupManager.isAPopupOpen || state === null) {
return false
}
- if (currentPopup.type !== PopupType.MultiCommitOperation) {
+ if (popupManager.currentPopup?.type !== PopupType.MultiCommitOperation) {
return false
}
diff --git a/app/src/ui/app.tsx b/app/src/ui/app.tsx
index 8a97914cbf..e8fe72a6e2 100644
--- a/app/src/ui/app.tsx
+++ b/app/src/ui/app.tsx
@@ -159,6 +159,7 @@ import { UnreachableCommitsDialog } from './history/unreachable-commits-dialog'
import { OpenPullRequestDialog } from './open-pull-request/open-pull-request-dialog'
import { sendNonFatalException } from '../lib/helpers/non-fatal-exception'
import { createCommitURL } from '../lib/commit-url'
+import { popupManager } from '../lib/popup-manager'
const MinuteInMilliseconds = 1000 * 60
const HourInMilliseconds = MinuteInMilliseconds * 60
@@ -215,7 +216,7 @@ export class App extends React.Component {
* modal dialog such as the preferences, or an error dialog.
*/
private get isShowingModal() {
- return this.state.currentPopup !== null || this.state.errors.length > 0
+ return popupManager.isAPopupOpen || this.state.errors.length > 0
}
/**
@@ -1375,7 +1376,7 @@ export class App extends React.Component {
return null
}
- const popup = this.state.currentPopup
+ const popup = popupManager.currentPopup
if (!popup) {
return null
diff --git a/app/src/ui/index.tsx b/app/src/ui/index.tsx
index 2d883d5606..8f037dcfc9 100644
--- a/app/src/ui/index.tsx
+++ b/app/src/ui/index.tsx
@@ -79,6 +79,7 @@ import { NotificationsStore } from '../lib/stores/notifications-store'
import * as ipcRenderer from '../lib/ipc-renderer'
import { migrateRendererGUID } from '../lib/get-renderer-guid'
import { initializeRendererNotificationHandler } from '../lib/notifications/notification-handler'
+import { popupManager } from '../lib/popup-manager'
if (__DEV__) {
installDevGlobals()
@@ -144,8 +145,8 @@ const sendErrorWithContext = (
extra.currentBanner = currentState.currentBanner.type
}
- if (currentState.currentPopup !== null) {
- extra.currentPopup = `${currentState.currentPopup.type}`
+ if (popupManager.currentPopup !== undefined) {
+ extra.currentPopup = `${popupManager.currentPopup.type}`
}
if (currentState.selectedState !== null) {
From 59a3c86d554434f59c3da82d59a62889870e1c9f Mon Sep 17 00:00:00 2001
From: tidy-dev <75402236+tidy-dev@users.noreply.github.com>
Date: Wed, 19 Oct 2022 12:10:13 -0400
Subject: [PATCH 117/262] Use logger, fix popuptypes, use uuid
---
app/src/lib/popup-manager.ts | 18 ++++++++++++------
1 file changed, 12 insertions(+), 6 deletions(-)
diff --git a/app/src/lib/popup-manager.ts b/app/src/lib/popup-manager.ts
index 8202cc073f..c0719adb1c 100644
--- a/app/src/lib/popup-manager.ts
+++ b/app/src/lib/popup-manager.ts
@@ -1,5 +1,5 @@
+import uuid from 'uuid'
import { Popup, PopupType } from '../models/popup'
-import { getObjectId } from '../ui/lib/object-id'
/**
* The popup manager is to manage the stack of currently open popups.
@@ -16,7 +16,7 @@ export class PopupManager {
}
public getPopupsOfType(popupType: PopupType): ReadonlyArray {
- return [...this.popupStack.filter(p => p.type !== popupType)]
+ return [...this.popupStack.filter(p => p.type === popupType)]
}
public isPopupsOfType(popupType: PopupType): boolean {
@@ -24,20 +24,26 @@ export class PopupManager {
}
public addPopup(popupToAdd: Popup): Popup {
- const popup = { id: getObjectId(popupToAdd), ...popupToAdd }
+ const existingPopup = this.getPopupsOfType(popupToAdd.type)
+ if (existingPopup.length > 0) {
+ log.warn(`Attempted to add a popup of already existing type.`)
+ return popupToAdd
+ }
+
+ const popup = { id: uuid(), ...popupToAdd }
this.popupStack.push(popup)
return popup
}
public updatePopup(popupToUpdate: Popup): Popup {
if (popupToUpdate.id === null) {
- console.warn(`Attempted to update a popup without an id.`)
+ log.warn(`Attempted to update a popup without an id.`)
return popupToUpdate
}
const index = this.popupStack.findIndex(p => p.id === popupToUpdate.id)
if (index < 0) {
- console.warn(`Attempted to update a popup not in the stack.`)
+ log.warn(`Attempted to update a popup not in the stack.`)
return popupToUpdate
}
@@ -51,7 +57,7 @@ export class PopupManager {
public removePopup(popup: Popup) {
if (popup.id === null) {
- console.warn(`Attempted to remove a popup without an id.`)
+ log.warn(`Attempted to remove a popup without an id.`)
return
}
this.popupStack = this.popupStack.filter(p => p.id !== popup.id)
From 6f9b2638bd94e19a179eae242fb4f9949263e45d Mon Sep 17 00:00:00 2001
From: tidy-dev <75402236+tidy-dev@users.noreply.github.com>
Date: Wed, 19 Oct 2022 13:16:42 -0400
Subject: [PATCH 118/262] Documenting
---
app/src/lib/popup-manager.ts | 27 +++++++++++++++++++++++++++
1 file changed, 27 insertions(+)
diff --git a/app/src/lib/popup-manager.ts b/app/src/lib/popup-manager.ts
index c0719adb1c..d1bd0c509a 100644
--- a/app/src/lib/popup-manager.ts
+++ b/app/src/lib/popup-manager.ts
@@ -7,22 +7,39 @@ import { Popup, PopupType } from '../models/popup'
export class PopupManager {
private popupStack = new Array()
+ /**
+ * Returns the last popup added to the stack.
+ */
public get currentPopup(): Popup | undefined {
return this.popupStack.at(-1)
}
+ /**
+ * Returns whether there are any popups in the stack.
+ */
public get isAPopupOpen(): boolean {
return this.currentPopup !== undefined
}
+ /**
+ * Returns an array of all popups in the stack of the provided type.
+ **/
public getPopupsOfType(popupType: PopupType): ReadonlyArray {
return [...this.popupStack.filter(p => p.type === popupType)]
}
+ /**
+ * Returns whether there are any popups of a given type in the stack.
+ */
public isPopupsOfType(popupType: PopupType): boolean {
return this.popupStack.some(p => p.type === popupType)
}
+ /**
+ * Adds a popup to the stack.
+ * - The popup will be given a unique id and returned.
+ * - It will not add multiple popups of the same type to the stack
+ **/
public addPopup(popupToAdd: Popup): Popup {
const existingPopup = this.getPopupsOfType(popupToAdd.type)
if (existingPopup.length > 0) {
@@ -35,6 +52,10 @@ export class PopupManager {
return popup
}
+ /**
+ * Updates a popup in the stack and returns it.
+ * - It uses the popup id to find and update the popup.
+ */
public updatePopup(popupToUpdate: Popup): Popup {
if (popupToUpdate.id === null) {
log.warn(`Attempted to update a popup without an id.`)
@@ -55,6 +76,9 @@ export class PopupManager {
return popupToUpdate
}
+ /**
+ * Removes a popup based on it's id.
+ */
public removePopup(popup: Popup) {
if (popup.id === null) {
log.warn(`Attempted to remove a popup without an id.`)
@@ -63,6 +87,9 @@ export class PopupManager {
this.popupStack = this.popupStack.filter(p => p.id !== popup.id)
}
+ /**
+ * Removes any popup of the given type from the stack
+ */
public removePopupByType(popupType: PopupType) {
this.popupStack = this.popupStack.filter(p => p.type !== popupType)
}
From e8aa39a064728b0a10b33d4b94327a3328515b62 Mon Sep 17 00:00:00 2001
From: tidy-dev
Date: Thu, 20 Oct 2022 14:37:05 -0400
Subject: [PATCH 119/262] Correct null/undefined check
---
app/src/lib/popup-manager.ts | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/app/src/lib/popup-manager.ts b/app/src/lib/popup-manager.ts
index d1bd0c509a..7606ccb83b 100644
--- a/app/src/lib/popup-manager.ts
+++ b/app/src/lib/popup-manager.ts
@@ -57,7 +57,7 @@ export class PopupManager {
* - It uses the popup id to find and update the popup.
*/
public updatePopup(popupToUpdate: Popup): Popup {
- if (popupToUpdate.id === null) {
+ if (popupToUpdate.id === undefined) {
log.warn(`Attempted to update a popup without an id.`)
return popupToUpdate
}
From fe1f46fc2f2dc4f1a7dfd27a01fdfbbdd9c72fc4 Mon Sep 17 00:00:00 2001
From: tidy-dev
Date: Thu, 20 Oct 2022 14:37:35 -0400
Subject: [PATCH 120/262] Add popup stack limit
---
app/src/lib/popup-manager.ts | 24 ++++++-
app/src/models/popup.ts | 126 +++++++++++++++++------------------
2 files changed, 86 insertions(+), 64 deletions(-)
diff --git a/app/src/lib/popup-manager.ts b/app/src/lib/popup-manager.ts
index 7606ccb83b..7253adf412 100644
--- a/app/src/lib/popup-manager.ts
+++ b/app/src/lib/popup-manager.ts
@@ -1,5 +1,13 @@
import uuid from 'uuid'
import { Popup, PopupType } from '../models/popup'
+import { sendNonFatalException } from './helpers/non-fatal-exception'
+
+/**
+ * The limit of how many popups allowed in the stack. Working under the
+ * assumption that a user should only be dealing with a couple of popups at a
+ * time, if a user hits the limit this would indicate a problem.
+ */
+const popupStackLimit = 50
/**
* The popup manager is to manage the stack of currently open popups.
@@ -43,12 +51,26 @@ export class PopupManager {
public addPopup(popupToAdd: Popup): Popup {
const existingPopup = this.getPopupsOfType(popupToAdd.type)
if (existingPopup.length > 0) {
- log.warn(`Attempted to add a popup of already existing type.`)
+ log.warn(
+ `Attempted to add a popup of already existing type - ${popupToAdd.type}.`
+ )
return popupToAdd
}
const popup = { id: uuid(), ...popupToAdd }
this.popupStack.push(popup)
+
+ if (this.popupStack.length > popupStackLimit) {
+ // Remove the oldest
+ const oldest = this.popupStack[0]
+ sendNonFatalException(
+ 'TooManyPopups',
+ new Error(
+ `Max number of ${popupStackLimit} popups reached while adding popup of type ${popup.type}. Removing last popup from the stack -> type ${oldest.type} `
+ )
+ )
+ this.popupStack = this.popupStack.slice(1)
+ }
return popup
}
diff --git a/app/src/models/popup.ts b/app/src/models/popup.ts
index cae0aba9ec..3bdab997a5 100644
--- a/app/src/models/popup.ts
+++ b/app/src/models/popup.ts
@@ -24,69 +24,69 @@ import { ValidNotificationPullRequestReview } from '../lib/valid-notification-pu
import { UnreachableCommitsTab } from '../ui/history/unreachable-commits-dialog'
export enum PopupType {
- RenameBranch = 1,
- DeleteBranch,
- DeleteRemoteBranch,
- ConfirmDiscardChanges,
- Preferences,
- RepositorySettings,
- AddRepository,
- CreateRepository,
- CloneRepository,
- CreateBranch,
- SignIn,
- About,
- InstallGit,
- PublishRepository,
- Acknowledgements,
- UntrustedCertificate,
- RemoveRepository,
- TermsAndConditions,
- PushBranchCommits,
- CLIInstalled,
- GenericGitAuthentication,
- ExternalEditorFailed,
- OpenShellFailed,
- InitializeLFS,
- LFSAttributeMismatch,
- UpstreamAlreadyExists,
- ReleaseNotes,
- DeletePullRequest,
- OversizedFiles,
- CommitConflictsWarning,
- PushNeedsPull,
- ConfirmForcePush,
- StashAndSwitchBranch,
- ConfirmOverwriteStash,
- ConfirmDiscardStash,
- CreateTutorialRepository,
- ConfirmExitTutorial,
- PushRejectedDueToMissingWorkflowScope,
- SAMLReauthRequired,
- CreateFork,
- CreateTag,
- DeleteTag,
- LocalChangesOverwritten,
- ChooseForkSettings,
- ConfirmDiscardSelection,
- MoveToApplicationsFolder,
- ChangeRepositoryAlias,
- ThankYou,
- CommitMessage,
- MultiCommitOperation,
- WarnLocalChangesBeforeUndo,
- WarningBeforeReset,
- InvalidatedToken,
- AddSSHHost,
- SSHKeyPassphrase,
- SSHUserPassword,
- PullRequestChecksFailed,
- CICheckRunRerun,
- WarnForcePush,
- DiscardChangesRetry,
- PullRequestReview,
- UnreachableCommits,
- StartPullRequest,
+ RenameBranch = 'RenameBranch',
+ DeleteBranch = 'DeleteBranch',
+ DeleteRemoteBranch = 'DeleteRemoteBranch',
+ ConfirmDiscardChanges = 'ConfirmDiscardChanges',
+ Preferences = 'Preferences',
+ RepositorySettings = 'RepositorySettings',
+ AddRepository = 'AddRepository',
+ CreateRepository = 'CreateRepository',
+ CloneRepository = 'CloneRepository',
+ CreateBranch = 'CreateBranch',
+ SignIn = 'SignIn',
+ About = 'About',
+ InstallGit = 'InstallGit',
+ PublishRepository = 'PublishRepository',
+ Acknowledgements = 'Acknowledgements',
+ UntrustedCertificate = 'UntrustedCertificate',
+ RemoveRepository = 'RemoveRepository',
+ TermsAndConditions = 'TermsAndConditions',
+ PushBranchCommits = 'PushBranchCommits',
+ CLIInstalled = 'CLIInstalled',
+ GenericGitAuthentication = 'GenericGitAuthentication',
+ ExternalEditorFailed = 'ExternalEditorFailed',
+ OpenShellFailed = 'OpenShellFailed',
+ InitializeLFS = 'InitializeLFS',
+ LFSAttributeMismatch = 'LFSAttributeMismatch',
+ UpstreamAlreadyExists = 'UpstreamAlreadyExists',
+ ReleaseNotes = 'ReleaseNotes',
+ DeletePullRequest = 'DeletePullRequest',
+ OversizedFiles = 'OversizedFiles',
+ CommitConflictsWarning = 'CommitConflictsWarning',
+ PushNeedsPull = 'PushNeedsPull',
+ ConfirmForcePush = 'ConfirmForcePush',
+ StashAndSwitchBranch = 'StashAndSwitchBranch',
+ ConfirmOverwriteStash = 'ConfirmOverwriteStash',
+ ConfirmDiscardStash = 'ConfirmDiscardStash',
+ CreateTutorialRepository = 'CreateTutorialRepository',
+ ConfirmExitTutorial = 'ConfirmExitTutorial',
+ PushRejectedDueToMissingWorkflowScope = 'PushRejectedDueToMissingWorkflowScope',
+ SAMLReauthRequired = 'SAMLReauthRequired',
+ CreateFork = 'CreateFork',
+ CreateTag = 'CreateTag',
+ DeleteTag = 'DeleteTag',
+ LocalChangesOverwritten = 'LocalChangesOverwritten',
+ ChooseForkSettings = 'ChooseForkSettings',
+ ConfirmDiscardSelection = 'ConfirmDiscardSelection',
+ MoveToApplicationsFolder = 'MoveToApplicationsFolder',
+ ChangeRepositoryAlias = 'ChangeRepositoryAlias',
+ ThankYou = 'ThankYou',
+ CommitMessage = 'CommitMessage',
+ MultiCommitOperation = 'MultiCommitOperation',
+ WarnLocalChangesBeforeUndo = 'WarnLocalChangesBeforeUndo',
+ WarningBeforeReset = 'WarningBeforeReset',
+ InvalidatedToken = 'InvalidatedToken',
+ AddSSHHost = 'AddSSHHost',
+ SSHKeyPassphrase = 'SSHKeyPassphrase',
+ SSHUserPassword = 'SSHUserPassword',
+ PullRequestChecksFailed = 'PullRequestChecksFailed',
+ CICheckRunRerun = 'CICheckRunRerun',
+ WarnForcePush = 'WarnForcePush',
+ DiscardChangesRetry = 'DiscardChangesRetry',
+ PullRequestReview = 'PullRequestReview',
+ UnreachableCommits = 'UnreachableCommits',
+ StartPullRequest = 'StartPullRequest',
}
interface IBasePopup {
From 1bee22cc75a031928b6168c3e205645974a17b65 Mon Sep 17 00:00:00 2001
From: tidy-dev <75402236+tidy-dev@users.noreply.github.com>
Date: Thu, 20 Oct 2022 15:25:37 -0400
Subject: [PATCH 121/262] grammars..
---
app/src/lib/multi-commit-operation.ts | 2 +-
app/src/lib/popup-manager.ts | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/app/src/lib/multi-commit-operation.ts b/app/src/lib/multi-commit-operation.ts
index 8b88338126..8694cdf0ae 100644
--- a/app/src/lib/multi-commit-operation.ts
+++ b/app/src/lib/multi-commit-operation.ts
@@ -43,7 +43,7 @@ export function isConflictsFlow(
multiCommitOperationState: IMultiCommitOperationState | null
): boolean {
return (
- popupManager.isPopupsOfType(PopupType.MultiCommitOperation) &&
+ popupManager.arePopupsOfType(PopupType.MultiCommitOperation) &&
multiCommitOperationState !== null &&
conflictSteps.includes(multiCommitOperationState.step.kind)
)
diff --git a/app/src/lib/popup-manager.ts b/app/src/lib/popup-manager.ts
index 7253adf412..f2f7ce3047 100644
--- a/app/src/lib/popup-manager.ts
+++ b/app/src/lib/popup-manager.ts
@@ -39,7 +39,7 @@ export class PopupManager {
/**
* Returns whether there are any popups of a given type in the stack.
*/
- public isPopupsOfType(popupType: PopupType): boolean {
+ public arePopupsOfType(popupType: PopupType): boolean {
return this.popupStack.some(p => p.type === popupType)
}
From 189767e3945194b26360c45f9860e83a8a4be7f4 Mon Sep 17 00:00:00 2001
From: Markus Olsson
Date: Fri, 21 Oct 2022 13:23:51 +0200
Subject: [PATCH 122/262] Full size PR create dialog
---
app/styles/ui/_dialog.scss | 21 ++++++++++++++-----
.../ui/_pull-request-files-changed.scss | 6 +++++-
app/styles/ui/dialogs/_open-pull-request.scss | 9 ++++++--
3 files changed, 28 insertions(+), 8 deletions(-)
diff --git a/app/styles/ui/_dialog.scss b/app/styles/ui/_dialog.scss
index f9e5550a87..c317f7bfd9 100644
--- a/app/styles/ui/_dialog.scss
+++ b/app/styles/ui/_dialog.scss
@@ -27,6 +27,9 @@
// allow easy layout using generalized components and elements such as
// and .
dialog {
+ display: flex;
+ flex-direction: column;
+
overflow: unset;
// These are the 24px versions of the alert and stop octicons
// from oction v10.0.0
@@ -128,11 +131,19 @@ dialog {
// The dialog embeds a fieldset as the first child of the form element
// in order to be able to disable all form elements and buttons in one
// swoop. This resets all styles for that fieldset.
- & > form > fieldset {
- border: 0;
- margin: 0;
- padding: 0;
- min-width: 0;
+ & > form {
+ min-height: 0;
+ & > fieldset {
+ border: 0;
+ margin: 0;
+ padding: 0;
+ min-width: 0;
+ min-height: 0;
+ max-height: 100%;
+
+ display: flex;
+ flex-direction: column;
+ }
}
.dialog-header {
diff --git a/app/styles/ui/_pull-request-files-changed.scss b/app/styles/ui/_pull-request-files-changed.scss
index 57f04d82a5..c432c65fe0 100644
--- a/app/styles/ui/_pull-request-files-changed.scss
+++ b/app/styles/ui/_pull-request-files-changed.scss
@@ -1,4 +1,8 @@
.pull-request-files-changed {
+ display: flex;
+ flex-direction: column;
+ min-height: 0;
+
border: var(--base-border);
border-radius: var(--border-radius);
@@ -13,8 +17,8 @@
}
.files-diff-viewer {
- height: 500px;
display: flex;
+ min-height: 0;
}
.file-list {
diff --git a/app/styles/ui/dialogs/_open-pull-request.scss b/app/styles/ui/dialogs/_open-pull-request.scss
index 7534652ca0..443c23c3d9 100644
--- a/app/styles/ui/dialogs/_open-pull-request.scss
+++ b/app/styles/ui/dialogs/_open-pull-request.scss
@@ -1,6 +1,8 @@
.open-pull-request {
- width: 850px;
- max-width: none;
+ width: 100%;
+ height: 100%;
+ max-width: calc(100% - var(--spacing-double) * 4);
+ max-height: calc(100% - var(--spacing-double) * 4);
header.dialog-header {
padding-bottom: var(--spacing);
@@ -21,6 +23,9 @@
.open-pull-request-content {
padding: var(--spacing);
+ display: flex;
+ flex-direction: column;
+ min-height: 0;
}
.open-pull-request-no-changes {
From d238d5e0bc313da6993617f98770b171134770fc Mon Sep 17 00:00:00 2001
From: Markus Olsson
Date: Fri, 21 Oct 2022 14:03:06 +0200
Subject: [PATCH 123/262] Expand to fill available height
---
app/styles/ui/_dialog.scss | 2 ++
app/styles/ui/_pull-request-files-changed.scss | 2 ++
app/styles/ui/dialogs/_open-pull-request.scss | 1 +
3 files changed, 5 insertions(+)
diff --git a/app/styles/ui/_dialog.scss b/app/styles/ui/_dialog.scss
index c317f7bfd9..a05fd82dd1 100644
--- a/app/styles/ui/_dialog.scss
+++ b/app/styles/ui/_dialog.scss
@@ -133,6 +133,7 @@ dialog {
// swoop. This resets all styles for that fieldset.
& > form {
min-height: 0;
+ height: 100%;
& > fieldset {
border: 0;
margin: 0;
@@ -140,6 +141,7 @@ dialog {
min-width: 0;
min-height: 0;
max-height: 100%;
+ height: 100%;
display: flex;
flex-direction: column;
diff --git a/app/styles/ui/_pull-request-files-changed.scss b/app/styles/ui/_pull-request-files-changed.scss
index c432c65fe0..55d72dadbd 100644
--- a/app/styles/ui/_pull-request-files-changed.scss
+++ b/app/styles/ui/_pull-request-files-changed.scss
@@ -2,6 +2,7 @@
display: flex;
flex-direction: column;
min-height: 0;
+ flex-grow: 1;
border: var(--base-border);
border-radius: var(--border-radius);
@@ -19,6 +20,7 @@
.files-diff-viewer {
display: flex;
min-height: 0;
+ flex-grow: 1;
}
.file-list {
diff --git a/app/styles/ui/dialogs/_open-pull-request.scss b/app/styles/ui/dialogs/_open-pull-request.scss
index 443c23c3d9..bb69524da2 100644
--- a/app/styles/ui/dialogs/_open-pull-request.scss
+++ b/app/styles/ui/dialogs/_open-pull-request.scss
@@ -26,6 +26,7 @@
display: flex;
flex-direction: column;
min-height: 0;
+ flex-grow: 1;
}
.open-pull-request-no-changes {
From 11d84577fa1898ccf98343e21244518cc08c08b4 Mon Sep 17 00:00:00 2001
From: Markus Olsson
Date: Fri, 21 Oct 2022 14:37:00 +0200
Subject: [PATCH 124/262] Refresh codemirror once the dialog has appeared fully
---
app/src/ui/dialog/dialog.tsx | 7 +++++++
app/src/ui/diff/code-mirror-host.tsx | 7 +++++++
2 files changed, 14 insertions(+)
diff --git a/app/src/ui/dialog/dialog.tsx b/app/src/ui/dialog/dialog.tsx
index 9f9c27b1a1..3ac49972e0 100644
--- a/app/src/ui/dialog/dialog.tsx
+++ b/app/src/ui/dialog/dialog.tsx
@@ -214,6 +214,13 @@ export class Dialog extends React.Component {
private onDismissGraceTimer = () => {
this.setState({ isAppearing: false })
+
+ this.dialogElement?.dispatchEvent(
+ new CustomEvent('dialog-appeared', {
+ bubbles: true,
+ cancelable: false,
+ })
+ )
}
private isDismissable() {
diff --git a/app/src/ui/diff/code-mirror-host.tsx b/app/src/ui/diff/code-mirror-host.tsx
index d840a34274..ab018444cf 100644
--- a/app/src/ui/diff/code-mirror-host.tsx
+++ b/app/src/ui/diff/code-mirror-host.tsx
@@ -164,6 +164,12 @@ export class CodeMirrorHost extends React.Component {
CodeMirrorHost.updateDoc(this.codeMirror, this.props.value)
this.resizeObserver.observe(this.codeMirror.getWrapperElement())
+
+ document.addEventListener('dialog-appeared', this.onDialogAppeared)
+ }
+
+ private onDialogAppeared = () => {
+ requestAnimationFrame(this.onResized)
}
private onSwapDoc = (cm: Editor, oldDoc: Doc) => {
@@ -199,6 +205,7 @@ export class CodeMirrorHost extends React.Component {
}
this.resizeObserver.disconnect()
+ document.removeEventListener('dialog-show', this.onDialogAppeared)
}
public componentDidUpdate(prevProps: ICodeMirrorHostProps) {
From 7bd2924c0ff75bafb52335e20d1e54ae7c607970 Mon Sep 17 00:00:00 2001
From: tidy-dev <75402236+tidy-dev@users.noreply.github.com>
Date: Fri, 21 Oct 2022 10:35:00 -0400
Subject: [PATCH 125/262] Centralize popup manager to be accessed through the
app-store
---
app/src/lib/app-state.ts | 2 ++
app/src/lib/menu-update.ts | 3 +-
app/src/lib/multi-commit-operation.ts | 5 ++-
app/src/lib/popup-manager.ts | 8 ++---
app/src/lib/stores/app-store.ts | 47 ++++++++++++++++++---------
app/src/ui/app.tsx | 5 ++-
app/src/ui/index.tsx | 5 ++-
7 files changed, 43 insertions(+), 32 deletions(-)
diff --git a/app/src/lib/app-state.ts b/app/src/lib/app-state.ts
index 952da275d1..bd996cb09f 100644
--- a/app/src/lib/app-state.ts
+++ b/app/src/lib/app-state.ts
@@ -46,6 +46,7 @@ import {
MultiCommitOperationStep,
} from '../models/multi-commit-operation'
import { IChangesetData } from './git'
+import { Popup } from '../models/popup'
export enum SelectionType {
Repository,
@@ -114,6 +115,7 @@ export interface IAppState {
readonly showWelcomeFlow: boolean
readonly focusCommitMessage: boolean
+ readonly currentPopup: Popup | null
readonly currentFoldout: Foldout | null
readonly currentBanner: Banner | null
diff --git a/app/src/lib/menu-update.ts b/app/src/lib/menu-update.ts
index c4825b0de1..9f0c644679 100644
--- a/app/src/lib/menu-update.ts
+++ b/app/src/lib/menu-update.ts
@@ -11,7 +11,6 @@ import { updateMenuState as ipcUpdateMenuState } from '../ui/main-process-proxy'
import { AppMenu, MenuItem } from '../models/app-menu'
import { hasConflictedFiles } from './status'
import { findContributionTargetDefaultBranch } from './branch'
-import { popupManager } from './popup-manager'
export interface IMenuItemState {
readonly enabled?: boolean
@@ -364,7 +363,7 @@ function getRepositoryMenuBuilder(state: IAppState): MenuStateBuilder {
}
function getMenuState(state: IAppState): Map {
- if (popupManager.isAPopupOpen) {
+ if (state.currentPopup) {
return getAllMenusDisabledBuilder().state
}
diff --git a/app/src/lib/multi-commit-operation.ts b/app/src/lib/multi-commit-operation.ts
index 8694cdf0ae..c1799a1dd1 100644
--- a/app/src/lib/multi-commit-operation.ts
+++ b/app/src/lib/multi-commit-operation.ts
@@ -4,10 +4,8 @@ import {
conflictSteps,
MultiCommitOperationStepKind,
} from '../models/multi-commit-operation'
-import { PopupType } from '../models/popup'
import { TipState } from '../models/tip'
import { IMultiCommitOperationState, IRepositoryState } from './app-state'
-import { popupManager } from './popup-manager'
/**
* Setup the multi commit operation state when the user needs to select a branch as the
@@ -40,10 +38,11 @@ export function getMultiCommitOperationChooseBranchStep(
}
export function isConflictsFlow(
+ isMultiCommitOperationPopupOpen: boolean,
multiCommitOperationState: IMultiCommitOperationState | null
): boolean {
return (
- popupManager.arePopupsOfType(PopupType.MultiCommitOperation) &&
+ isMultiCommitOperationPopupOpen &&
multiCommitOperationState !== null &&
conflictSteps.includes(multiCommitOperationState.step.kind)
)
diff --git a/app/src/lib/popup-manager.ts b/app/src/lib/popup-manager.ts
index f2f7ce3047..97e611253b 100644
--- a/app/src/lib/popup-manager.ts
+++ b/app/src/lib/popup-manager.ts
@@ -18,15 +18,15 @@ export class PopupManager {
/**
* Returns the last popup added to the stack.
*/
- public get currentPopup(): Popup | undefined {
- return this.popupStack.at(-1)
+ public get currentPopup(): Popup | null {
+ return this.popupStack.at(-1) ?? null
}
/**
* Returns whether there are any popups in the stack.
*/
public get isAPopupOpen(): boolean {
- return this.currentPopup !== undefined
+ return this.currentPopup !== null
}
/**
@@ -116,5 +116,3 @@ export class PopupManager {
this.popupStack = this.popupStack.filter(p => p.type !== popupType)
}
}
-
-export const popupManager = new PopupManager()
diff --git a/app/src/lib/stores/app-store.ts b/app/src/lib/stores/app-store.ts
index 4aae35489d..5353a20a0a 100644
--- a/app/src/lib/stores/app-store.ts
+++ b/app/src/lib/stores/app-store.ts
@@ -304,7 +304,7 @@ import { offsetFromNow } from '../offset-from'
import { findContributionTargetDefaultBranch } from '../branch'
import { ValidNotificationPullRequestReview } from '../valid-notification-pull-request-review'
import { determineMergeability } from '../git/merge-tree'
-import { popupManager } from '../popup-manager'
+import { PopupManager } from '../popup-manager'
const LastSelectedRepositoryIDKey = 'last-selected-repository-id'
@@ -500,6 +500,9 @@ export class AppStore extends TypedBaseStore {
private lastThankYou: ILastThankYou | undefined
private showCIStatusPopover: boolean = false
+ /** A service for managing the stack of open popups */
+ private popupManager = new PopupManager()
+
public constructor(
private readonly gitHubUserStore: GitHubUserStore,
private readonly cloningRepositoriesStore: CloningRepositoriesStore,
@@ -639,7 +642,7 @@ export class AppStore extends TypedBaseStore {
// If there is a currently open popup, don't do anything here. Since the
// app can only show one popup at a time, we don't want to close the current
// one in favor of the error we're about to show.
- if (popupManager.isAPopupOpen) {
+ if (this.popupManager.isAPopupOpen) {
return
}
@@ -904,6 +907,7 @@ export class AppStore extends TypedBaseStore {
appIsFocused: this.appIsFocused,
selectedState: this.getSelectedState(),
signInState: this.signInStore.getState(),
+ currentPopup: this.popupManager.currentPopup,
currentFoldout: this.currentFoldout,
errors: this.errors,
showWelcomeFlow: this.showWelcomeFlow,
@@ -2505,7 +2509,13 @@ export class AppStore extends TypedBaseStore {
this.currentBanner !== null &&
this.currentBanner.type === BannerType.ConflictsFound
- if (displayingBanner || isConflictsFlow(multiCommitOperationState)) {
+ if (
+ displayingBanner ||
+ isConflictsFlow(
+ this.popupManager.arePopupsOfType(PopupType.MultiCommitOperation),
+ multiCommitOperationState
+ )
+ ) {
return
}
@@ -2592,7 +2602,12 @@ export class AppStore extends TypedBaseStore {
*/
private clearConflictsFlowVisuals(state: IRepositoryState) {
const { multiCommitOperationState } = state
- if (userIsStartingMultiCommitOperation(multiCommitOperationState)) {
+ if (
+ userIsStartingMultiCommitOperation(
+ this.popupManager.currentPopup,
+ multiCommitOperationState
+ )
+ ) {
return
}
@@ -3475,19 +3490,19 @@ export class AppStore extends TypedBaseStore {
// applicable on Windows where we draw a custom app menu.
this._closeFoldout(FoldoutType.AppMenu)
- popupManager.addPopup(popup)
+ this.popupManager.addPopup(popup)
this.emitUpdate()
}
/** This shouldn't be called directly. See `Dispatcher`. */
public _closePopup(popupType?: PopupType) {
- const currentPopup = popupManager.currentPopup
- if (currentPopup === undefined) {
+ const currentPopup = this.popupManager.currentPopup
+ if (currentPopup === null) {
return
}
if (popupType === undefined) {
- popupManager.removePopup(currentPopup)
+ this.popupManager.removePopup(currentPopup)
} else {
if (currentPopup.type !== popupType) {
return
@@ -3497,7 +3512,7 @@ export class AppStore extends TypedBaseStore {
this._completeOpenInDesktop(() => Promise.resolve(null))
}
- popupManager.removePopupByType(popupType)
+ this.popupManager.removePopupByType(popupType)
}
this.emitUpdate()
@@ -6491,12 +6506,11 @@ export class AppStore extends TypedBaseStore {
path,
(title, value, description) => {
if (
- popupManager.currentPopup !== undefined &&
- popupManager.currentPopup.type ===
- PopupType.CreateTutorialRepository
+ this.popupManager.currentPopup?.type ===
+ PopupType.CreateTutorialRepository
) {
- popupManager.updatePopup({
- ...popupManager.currentPopup,
+ this.popupManager.updatePopup({
+ ...this.popupManager.currentPopup,
progress: { kind: 'generic', title, value, description },
})
this.emitUpdate()
@@ -7483,13 +7497,14 @@ function getInitialAction(
}
function userIsStartingMultiCommitOperation(
+ currentPopup: Popup | null,
state: IMultiCommitOperationState | null
) {
- if (!popupManager.isAPopupOpen || state === null) {
+ if (currentPopup === null || state === null) {
return false
}
- if (popupManager.currentPopup?.type !== PopupType.MultiCommitOperation) {
+ if (currentPopup.type !== PopupType.MultiCommitOperation) {
return false
}
diff --git a/app/src/ui/app.tsx b/app/src/ui/app.tsx
index e8fe72a6e2..8a97914cbf 100644
--- a/app/src/ui/app.tsx
+++ b/app/src/ui/app.tsx
@@ -159,7 +159,6 @@ import { UnreachableCommitsDialog } from './history/unreachable-commits-dialog'
import { OpenPullRequestDialog } from './open-pull-request/open-pull-request-dialog'
import { sendNonFatalException } from '../lib/helpers/non-fatal-exception'
import { createCommitURL } from '../lib/commit-url'
-import { popupManager } from '../lib/popup-manager'
const MinuteInMilliseconds = 1000 * 60
const HourInMilliseconds = MinuteInMilliseconds * 60
@@ -216,7 +215,7 @@ export class App extends React.Component {
* modal dialog such as the preferences, or an error dialog.
*/
private get isShowingModal() {
- return popupManager.isAPopupOpen || this.state.errors.length > 0
+ return this.state.currentPopup !== null || this.state.errors.length > 0
}
/**
@@ -1376,7 +1375,7 @@ export class App extends React.Component {
return null
}
- const popup = popupManager.currentPopup
+ const popup = this.state.currentPopup
if (!popup) {
return null
diff --git a/app/src/ui/index.tsx b/app/src/ui/index.tsx
index 8f037dcfc9..2d883d5606 100644
--- a/app/src/ui/index.tsx
+++ b/app/src/ui/index.tsx
@@ -79,7 +79,6 @@ import { NotificationsStore } from '../lib/stores/notifications-store'
import * as ipcRenderer from '../lib/ipc-renderer'
import { migrateRendererGUID } from '../lib/get-renderer-guid'
import { initializeRendererNotificationHandler } from '../lib/notifications/notification-handler'
-import { popupManager } from '../lib/popup-manager'
if (__DEV__) {
installDevGlobals()
@@ -145,8 +144,8 @@ const sendErrorWithContext = (
extra.currentBanner = currentState.currentBanner.type
}
- if (popupManager.currentPopup !== undefined) {
- extra.currentPopup = `${popupManager.currentPopup.type}`
+ if (currentState.currentPopup !== null) {
+ extra.currentPopup = `${currentState.currentPopup.type}`
}
if (currentState.selectedState !== null) {
From 27b29a0ea03afe549bafa0bc5fbf5ef02a799263 Mon Sep 17 00:00:00 2001
From: Shivareddy-Aluri
Date: Mon, 24 Oct 2022 15:00:04 +0530
Subject: [PATCH 126/262] ability to copy tag names from the commit list.
---
app/src/ui/history/commit-list-item.tsx | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/app/src/ui/history/commit-list-item.tsx b/app/src/ui/history/commit-list-item.tsx
index dc4d4bb4be..c6acedad30 100644
--- a/app/src/ui/history/commit-list-item.tsx
+++ b/app/src/ui/history/commit-list-item.tsx
@@ -219,6 +219,10 @@ export class CommitListItem extends React.PureComponent<
clipboard.writeText(this.props.commit.sha)
}
+ private onCopyTags = () => {
+ clipboard.writeText(this.props.commit.tags.join(', '))
+ }
+
private onViewOnGitHub = () => {
if (this.props.onViewCommitOnGitHub) {
this.props.onViewCommitOnGitHub(this.props.commit.sha)
@@ -353,6 +357,11 @@ export class CommitListItem extends React.PureComponent<
label: 'Copy SHA',
action: this.onCopySHA,
},
+ {
+ label: 'Copy Tags',
+ action: this.onCopyTags,
+ enabled: this.props.commit.tags.length > 0
+ },
{
label: viewOnGitHubLabel,
action: this.onViewOnGitHub,
From 53cc945f92df336895449ec17ba892b98016e89a Mon Sep 17 00:00:00 2001
From: tidy-dev <75402236+tidy-dev@users.noreply.github.com>
Date: Mon, 24 Oct 2022 06:03:31 -0400
Subject: [PATCH 127/262] No need for array copy.
Co-authored-by: Sergio Padrino
---
app/src/lib/popup-manager.ts | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/app/src/lib/popup-manager.ts b/app/src/lib/popup-manager.ts
index 97e611253b..095e460d97 100644
--- a/app/src/lib/popup-manager.ts
+++ b/app/src/lib/popup-manager.ts
@@ -33,7 +33,7 @@ export class PopupManager {
* Returns an array of all popups in the stack of the provided type.
**/
public getPopupsOfType(popupType: PopupType): ReadonlyArray {
- return [...this.popupStack.filter(p => p.type === popupType)]
+ return this.popupStack.filter(p => p.type === popupType)
}
/**
From 3cc3b8814887a66078b82f3753339f6274c69849 Mon Sep 17 00:00:00 2001
From: tidy-dev <75402236+tidy-dev@users.noreply.github.com>
Date: Mon, 24 Oct 2022 06:08:50 -0400
Subject: [PATCH 128/262] Should be checking against undefined
Co-authored-by: Sergio Padrino
---
app/src/lib/popup-manager.ts | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/app/src/lib/popup-manager.ts b/app/src/lib/popup-manager.ts
index 095e460d97..fcd1c399a7 100644
--- a/app/src/lib/popup-manager.ts
+++ b/app/src/lib/popup-manager.ts
@@ -102,7 +102,7 @@ export class PopupManager {
* Removes a popup based on it's id.
*/
public removePopup(popup: Popup) {
- if (popup.id === null) {
+ if (popup.id === undefined) {
log.warn(`Attempted to remove a popup without an id.`)
return
}
From 4a4ef96015981bc5075bcf62aa2e740fc1cbb9ba Mon Sep 17 00:00:00 2001
From: tidy-dev <75402236+tidy-dev@users.noreply.github.com>
Date: Mon, 24 Oct 2022 06:10:20 -0400
Subject: [PATCH 129/262] Are there or are?
Co-Authored-By: Sergio Padrino <1083228+sergiou87@users.noreply.github.com>
---
app/src/lib/popup-manager.ts | 2 +-
app/src/lib/stores/app-store.ts | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/app/src/lib/popup-manager.ts b/app/src/lib/popup-manager.ts
index 97e611253b..7a985ccae1 100644
--- a/app/src/lib/popup-manager.ts
+++ b/app/src/lib/popup-manager.ts
@@ -39,7 +39,7 @@ export class PopupManager {
/**
* Returns whether there are any popups of a given type in the stack.
*/
- public arePopupsOfType(popupType: PopupType): boolean {
+ public areTherePopupsOfType(popupType: PopupType): boolean {
return this.popupStack.some(p => p.type === popupType)
}
diff --git a/app/src/lib/stores/app-store.ts b/app/src/lib/stores/app-store.ts
index 5353a20a0a..6e37e97476 100644
--- a/app/src/lib/stores/app-store.ts
+++ b/app/src/lib/stores/app-store.ts
@@ -2512,7 +2512,7 @@ export class AppStore extends TypedBaseStore {
if (
displayingBanner ||
isConflictsFlow(
- this.popupManager.arePopupsOfType(PopupType.MultiCommitOperation),
+ this.popupManager.areTherePopupsOfType(PopupType.MultiCommitOperation),
multiCommitOperationState
)
) {
From ae91f5acfd30c622a6d53a2d81c26e48c720ced8 Mon Sep 17 00:00:00 2001
From: tidy-dev <75402236+tidy-dev@users.noreply.github.com>
Date: Mon, 24 Oct 2022 06:11:53 -0400
Subject: [PATCH 130/262] Less changes same extensibility
This reverts commit ba0cbcde3efc5df08675378402cf767f3361b1d8.
Co-Authored-By: Sergio Padrino <1083228+sergiou87@users.noreply.github.com>
---
app/src/models/popup.ts | 738 ++++++++++++++++------------------------
1 file changed, 284 insertions(+), 454 deletions(-)
diff --git a/app/src/models/popup.ts b/app/src/models/popup.ts
index 3bdab997a5..55b0d31b48 100644
--- a/app/src/models/popup.ts
+++ b/app/src/models/popup.ts
@@ -96,458 +96,288 @@ interface IBasePopup {
readonly id?: string
}
-interface IRenameBranchPopup extends IBasePopup {
- type: PopupType.RenameBranch
- repository: Repository
- branch: Branch
-}
+export type PopupDetail =
+ | { type: PopupType.RenameBranch; repository: Repository; branch: Branch }
+ | {
+ type: PopupType.DeleteBranch
+ repository: Repository
+ branch: Branch
+ existsOnRemote: boolean
+ }
+ | {
+ type: PopupType.DeleteRemoteBranch
+ repository: Repository
+ branch: Branch
+ }
+ | {
+ type: PopupType.ConfirmDiscardChanges
+ repository: Repository
+ files: ReadonlyArray
+ showDiscardChangesSetting?: boolean
+ discardingAllChanges?: boolean
+ }
+ | {
+ type: PopupType.ConfirmDiscardSelection
+ repository: Repository
+ file: WorkingDirectoryFileChange
+ diff: ITextDiff
+ selection: DiffSelection
+ }
+ | { type: PopupType.Preferences; initialSelectedTab?: PreferencesTab }
+ | {
+ type: PopupType.RepositorySettings
+ repository: Repository
+ initialSelectedTab?: RepositorySettingsTab
+ }
+ | { type: PopupType.AddRepository; path?: string }
+ | { type: PopupType.CreateRepository; path?: string }
+ | {
+ type: PopupType.CloneRepository
+ initialURL: string | null
+ }
+ | {
+ type: PopupType.CreateBranch
+ repository: Repository
+ initialName?: string
+ targetCommit?: CommitOneLine
+ }
+ | { type: PopupType.SignIn }
+ | { type: PopupType.About }
+ | { type: PopupType.InstallGit; path: string }
+ | { type: PopupType.PublishRepository; repository: Repository }
+ | { type: PopupType.Acknowledgements }
+ | {
+ type: PopupType.UntrustedCertificate
+ certificate: Electron.Certificate
+ url: string
+ }
+ | { type: PopupType.RemoveRepository; repository: Repository }
+ | { type: PopupType.TermsAndConditions }
+ | {
+ type: PopupType.PushBranchCommits
+ repository: Repository
+ branch: Branch
+ unPushedCommits?: number
+ }
+ | { type: PopupType.CLIInstalled }
+ | {
+ type: PopupType.GenericGitAuthentication
+ hostname: string
+ retryAction: RetryAction
+ }
+ | {
+ type: PopupType.ExternalEditorFailed
+ message: string
+ suggestDefaultEditor?: boolean
+ openPreferences?: boolean
+ }
+ | { type: PopupType.OpenShellFailed; message: string }
+ | { type: PopupType.InitializeLFS; repositories: ReadonlyArray }
+ | { type: PopupType.LFSAttributeMismatch }
+ | {
+ type: PopupType.UpstreamAlreadyExists
+ repository: Repository
+ existingRemote: IRemote
+ }
+ | {
+ type: PopupType.ReleaseNotes
+ newReleases: ReadonlyArray
+ }
+ | {
+ type: PopupType.DeletePullRequest
+ repository: Repository
+ branch: Branch
+ pullRequest: PullRequest
+ }
+ | {
+ type: PopupType.OversizedFiles
+ oversizedFiles: ReadonlyArray
+ context: ICommitContext
+ repository: Repository
+ }
+ | {
+ type: PopupType.CommitConflictsWarning
+ /** files that were selected for committing that are also conflicted */
+ files: ReadonlyArray
+ /** repository user is committing in */
+ repository: Repository
+ /** information for completing the commit */
+ context: ICommitContext
+ }
+ | {
+ type: PopupType.PushNeedsPull
+ repository: Repository
+ }
+ | {
+ type: PopupType.ConfirmForcePush
+ repository: Repository
+ upstreamBranch: string
+ }
+ | {
+ type: PopupType.StashAndSwitchBranch
+ repository: Repository
+ branchToCheckout: Branch
+ }
+ | {
+ type: PopupType.ConfirmOverwriteStash
+ repository: Repository
+ branchToCheckout: Branch | null
+ }
+ | {
+ type: PopupType.ConfirmDiscardStash
+ repository: Repository
+ stash: IStashEntry
+ }
+ | {
+ type: PopupType.CreateTutorialRepository
+ account: Account
+ progress?: Progress
+ }
+ | {
+ type: PopupType.ConfirmExitTutorial
+ }
+ | {
+ type: PopupType.PushRejectedDueToMissingWorkflowScope
+ rejectedPath: string
+ repository: RepositoryWithGitHubRepository
+ }
+ | {
+ type: PopupType.SAMLReauthRequired
+ organizationName: string
+ endpoint: string
+ retryAction?: RetryAction
+ }
+ | {
+ type: PopupType.CreateFork
+ repository: RepositoryWithGitHubRepository
+ account: Account
+ }
+ | {
+ type: PopupType.CreateTag
+ repository: Repository
+ targetCommitSha: string
+ initialName?: string
+ localTags: Map | null
+ }
+ | {
+ type: PopupType.DeleteTag
+ repository: Repository
+ tagName: string
+ }
+ | {
+ type: PopupType.ChooseForkSettings
+ repository: RepositoryWithForkedGitHubRepository
+ }
+ | {
+ type: PopupType.LocalChangesOverwritten
+ repository: Repository
+ retryAction: RetryAction
+ files: ReadonlyArray
+ }
+ | { type: PopupType.MoveToApplicationsFolder }
+ | { type: PopupType.ChangeRepositoryAlias; repository: Repository }
+ | {
+ type: PopupType.ThankYou
+ userContributions: ReadonlyArray
+ friendlyName: string
+ latestVersion: string | null
+ }
+ | {
+ type: PopupType.CommitMessage
+ coAuthors: ReadonlyArray
+ showCoAuthoredBy: boolean
+ commitMessage: ICommitMessage | null
+ dialogTitle: string
+ dialogButtonText: string
+ prepopulateCommitSummary: boolean
+ repository: Repository
+ onSubmitCommitMessage: (context: ICommitContext) => Promise
+ }
+ | {
+ type: PopupType.MultiCommitOperation
+ repository: Repository
+ }
+ | {
+ type: PopupType.WarnLocalChangesBeforeUndo
+ repository: Repository
+ commit: Commit
+ isWorkingDirectoryClean: boolean
+ }
+ | {
+ type: PopupType.WarningBeforeReset
+ repository: Repository
+ commit: Commit
+ }
+ | {
+ type: PopupType.InvalidatedToken
+ account: Account
+ }
+ | {
+ type: PopupType.AddSSHHost
+ host: string
+ ip: string
+ keyType: string
+ fingerprint: string
+ onSubmit: (addHost: boolean) => void
+ }
+ | {
+ type: PopupType.SSHKeyPassphrase
+ keyPath: string
+ onSubmit: (
+ passphrase: string | undefined,
+ storePassphrase: boolean
+ ) => void
+ }
+ | {
+ type: PopupType.SSHUserPassword
+ username: string
+ onSubmit: (password: string | undefined, storePassword: boolean) => void
+ }
+ | {
+ type: PopupType.PullRequestChecksFailed
+ repository: RepositoryWithGitHubRepository
+ pullRequest: PullRequest
+ shouldChangeRepository: boolean
+ commitMessage: string
+ commitSha: string
+ checks: ReadonlyArray
+ }
+ | {
+ type: PopupType.CICheckRunRerun
+ checkRuns: ReadonlyArray
+ repository: GitHubRepository
+ prRef: string
+ failedOnly: boolean
+ }
+ | { type: PopupType.WarnForcePush; operation: string; onBegin: () => void }
+ | {
+ type: PopupType.DiscardChangesRetry
+ retryAction: RetryAction
+ }
+ | {
+ type: PopupType.PullRequestReview
+ repository: RepositoryWithGitHubRepository
+ pullRequest: PullRequest
+ review: ValidNotificationPullRequestReview
+ numberOfComments: number
+ shouldCheckoutBranch: boolean
+ shouldChangeRepository: boolean
+ }
+ | {
+ type: PopupType.UnreachableCommits
+ selectedTab: UnreachableCommitsTab
+ }
+ | {
+ type: PopupType.StartPullRequest
+ allBranches: ReadonlyArray
+ currentBranch: Branch
+ defaultBranch: Branch | null
+ externalEditorLabel?: string
+ imageDiffType: ImageDiffType
+ recentBranches: ReadonlyArray
+ repository: Repository
+ nonLocalCommitSHA: string | null
+ showSideBySideDiff: boolean
+ }
-interface IDeleteBranchPopup extends IBasePopup {
- type: PopupType.DeleteBranch
- repository: Repository
- branch: Branch
- existsOnRemote: boolean
-}
-
-interface IDeleteRemoteBranchPopup extends IBasePopup {
- type: PopupType.DeleteRemoteBranch
- repository: Repository
- branch: Branch
-}
-
-interface IConfirmDiscardChangesPopup extends IBasePopup {
- type: PopupType.ConfirmDiscardChanges
- repository: Repository
- files: ReadonlyArray
- showDiscardChangesSetting?: boolean
- discardingAllChanges?: boolean
-}
-
-interface IConfirmDiscardSelectionPopup extends IBasePopup {
- type: PopupType.ConfirmDiscardSelection
- repository: Repository
- file: WorkingDirectoryFileChange
- diff: ITextDiff
- selection: DiffSelection
-}
-
-interface IPreferencesPopup extends IBasePopup {
- type: PopupType.Preferences
- initialSelectedTab?: PreferencesTab
-}
-
-interface IRepositorySettingsPopup extends IBasePopup {
- type: PopupType.RepositorySettings
- repository: Repository
- initialSelectedTab?: RepositorySettingsTab
-}
-
-interface IAddRepositoryPopup extends IBasePopup {
- type: PopupType.AddRepository
- path?: string
-}
-
-interface ICreateRepositoryPopup extends IBasePopup {
- type: PopupType.CreateRepository
- path?: string
-}
-
-interface ICloneRepositoryPopup extends IBasePopup {
- type: PopupType.CloneRepository
- initialURL: string | null
-}
-
-interface ICreateBranchPopup extends IBasePopup {
- type: PopupType.CreateBranch
- repository: Repository
- initialName?: string
- targetCommit?: CommitOneLine
-}
-
-interface ISignInPopup extends IBasePopup {
- type: PopupType.SignIn
-}
-
-interface IAboutPopup extends IBasePopup {
- type: PopupType.About
-}
-
-interface IInstallGitPopup extends IBasePopup {
- type: PopupType.InstallGit
- path: string
-}
-
-interface IPublishRepositoryPopup extends IBasePopup {
- type: PopupType.PublishRepository
- repository: Repository
-}
-
-interface IAcknowledgementsPopup extends IBasePopup {
- type: PopupType.Acknowledgements
-}
-
-interface IUntrustedCertificatePopup extends IBasePopup {
- type: PopupType.UntrustedCertificate
- certificate: Electron.Certificate
- url: string
-}
-
-interface IRemoveRepositoryPopup extends IBasePopup {
- type: PopupType.RemoveRepository
- repository: Repository
-}
-
-interface ITermsAndConditionsPopup extends IBasePopup {
- type: PopupType.TermsAndConditions
-}
-
-interface IPushBranchCommitsPopup extends IBasePopup {
- type: PopupType.PushBranchCommits
- repository: Repository
- branch: Branch
- unPushedCommits?: number
-}
-
-interface ICLIInstalledPopup extends IBasePopup {
- type: PopupType.CLIInstalled
-}
-
-interface IGenericGitAuthenticationPopup extends IBasePopup {
- type: PopupType.GenericGitAuthentication
- hostname: string
- retryAction: RetryAction
-}
-
-interface IExternalEditorFailedPopup extends IBasePopup {
- type: PopupType.ExternalEditorFailed
- message: string
- suggestDefaultEditor?: boolean
- openPreferences?: boolean
-}
-
-interface IOpenShellFailedPopup extends IBasePopup {
- type: PopupType.OpenShellFailed
- message: string
-}
-
-interface IInitializeLFSPopup extends IBasePopup {
- type: PopupType.InitializeLFS
- repositories: ReadonlyArray
-}
-
-interface ILFSAttributeMismatchPopup extends IBasePopup {
- type: PopupType.LFSAttributeMismatch
-}
-
-interface IUpstreamAlreadyExistsPopup extends IBasePopup {
- type: PopupType.UpstreamAlreadyExists
- repository: Repository
- existingRemote: IRemote
-}
-
-interface IReleaseNotesPopup extends IBasePopup {
- type: PopupType.ReleaseNotes
- newReleases: ReadonlyArray
-}
-
-interface IDeletePullRequestPopup extends IBasePopup {
- type: PopupType.DeletePullRequest
- repository: Repository
- branch: Branch
- pullRequest: PullRequest
-}
-
-interface IOversizedFilesPopup extends IBasePopup {
- type: PopupType.OversizedFiles
- oversizedFiles: ReadonlyArray
- context: ICommitContext
- repository: Repository
-}
-
-interface ICommitConflictsWarningPopup extends IBasePopup {
- type: PopupType.CommitConflictsWarning
- /** files that were selected for committing that are also conflicted */
- files: ReadonlyArray
- /** repository user is committing in */
- repository: Repository
- /** information for completing the commit */
- context: ICommitContext
-}
-
-interface IPushNeedsPullPopup extends IBasePopup {
- type: PopupType.PushNeedsPull
- repository: Repository
-}
-
-interface IConfirmForcePushPopup extends IBasePopup {
- type: PopupType.ConfirmForcePush
- repository: Repository
- upstreamBranch: string
-}
-
-interface IStashAndSwitchBranchPopup extends IBasePopup {
- type: PopupType.StashAndSwitchBranch
- repository: Repository
- branchToCheckout: Branch
-}
-
-interface IConfirmOverwriteStashPopup extends IBasePopup {
- type: PopupType.ConfirmOverwriteStash
- repository: Repository
- branchToCheckout: Branch | null
-}
-
-interface IConfirmDiscardStashPopup extends IBasePopup {
- type: PopupType.ConfirmDiscardStash
- repository: Repository
- stash: IStashEntry
-}
-
-interface ICreateTutorialRepositoryPopup extends IBasePopup {
- type: PopupType.CreateTutorialRepository
- account: Account
- progress?: Progress
-}
-
-interface IConfirmExitTutorialPopup extends IBasePopup {
- type: PopupType.ConfirmExitTutorial
-}
-
-interface IPushRejectedDueToMissingWorkflowScopePopup extends IBasePopup {
- type: PopupType.PushRejectedDueToMissingWorkflowScope
- rejectedPath: string
- repository: RepositoryWithGitHubRepository
-}
-
-interface ISAMLReauthRequiredPopup extends IBasePopup {
- type: PopupType.SAMLReauthRequired
- organizationName: string
- endpoint: string
- retryAction?: RetryAction
-}
-
-interface ICreateForkPopup extends IBasePopup {
- type: PopupType.CreateFork
- repository: RepositoryWithGitHubRepository
- account: Account
-}
-
-interface ICreateTagPopup extends IBasePopup {
- type: PopupType.CreateTag
- repository: Repository
- targetCommitSha: string
- initialName?: string
- localTags: Map | null
-}
-
-interface IDeleteTagPopup extends IBasePopup {
- type: PopupType.DeleteTag
- repository: Repository
- tagName: string
-}
-
-interface IChooseForkSettingsPopup extends IBasePopup {
- type: PopupType.ChooseForkSettings
- repository: RepositoryWithForkedGitHubRepository
-}
-
-interface ILocalChangesOverwrittenPopup extends IBasePopup {
- type: PopupType.LocalChangesOverwritten
- repository: Repository
- retryAction: RetryAction
- files: ReadonlyArray
-}
-
-interface IMoveToApplicationsFolderPopup extends IBasePopup {
- type: PopupType.MoveToApplicationsFolder
-}
-
-interface IChangeRepositoryAliasPopup extends IBasePopup {
- type: PopupType.ChangeRepositoryAlias
- repository: Repository
-}
-
-interface IThankYouPopup extends IBasePopup {
- type: PopupType.ThankYou
- userContributions: ReadonlyArray
- friendlyName: string
- latestVersion: string | null
-}
-
-interface ICommitMessagePopup extends IBasePopup {
- type: PopupType.CommitMessage
- coAuthors: ReadonlyArray