mirror of
https://github.com/jesseduffield/lazygit.git
synced 2026-09-11 08:06:25 -04:00
generate github state struct
This commit is contained in:
parent
d2e75a6359
commit
c8de14aa9d
|
|
@ -81,7 +81,7 @@ func (gui *Gui) refreshGithubPullRequests() {
|
|||
gui.Log.Error(err)
|
||||
}
|
||||
|
||||
gui.State.GithubRecentPRs = prs
|
||||
gui.State.GithubState.RecentPRs = prs
|
||||
}
|
||||
|
||||
// specific functions
|
||||
|
|
|
|||
|
|
@ -291,7 +291,7 @@ type guiState struct {
|
|||
CommitFileManager *filetree.CommitFileManager
|
||||
Submodules []*models.SubmoduleConfig
|
||||
Branches []*models.Branch
|
||||
GithubRecentPRs []*models.GithubPullRequest
|
||||
GithubState *GithubState
|
||||
Commits []*models.Commit
|
||||
StashEntries []*models.StashEntry
|
||||
// Suggestions will sometimes appear when typing into a prompt
|
||||
|
|
@ -346,6 +346,10 @@ type guiState struct {
|
|||
FilesTrie *patricia.Trie
|
||||
}
|
||||
|
||||
type GithubState struct {
|
||||
RecentPRs []*models.GithubPullRequest
|
||||
}
|
||||
|
||||
// reuseState determines if we pull the repo state from our repo state map or
|
||||
// just re-initialize it. For now we're only re-using state when we're going
|
||||
// in and out of submodules, for the sake of having the cursor back on the submodule
|
||||
|
|
@ -408,7 +412,8 @@ func (gui *Gui) resetState(filterPath string, reuseState bool) {
|
|||
UserScrolling: false,
|
||||
},
|
||||
},
|
||||
Ptmx: nil,
|
||||
GithubState: &GithubState{},
|
||||
Ptmx: nil,
|
||||
Modes: Modes{
|
||||
Filtering: filtering.New(filterPath),
|
||||
CherryPicking: cherrypicking.New(),
|
||||
|
|
@ -732,7 +737,7 @@ func (gui *Gui) setColorScheme() error {
|
|||
}
|
||||
|
||||
func (gui *Gui) GetPr(branch *models.Branch) (*models.GithubPullRequest, bool) {
|
||||
prs := gui.GitCommand.GenerateGithubPullRequestMap(gui.State.GithubRecentPRs, []*models.Branch{branch})
|
||||
prs := gui.GitCommand.GenerateGithubPullRequestMap(gui.State.GithubState.RecentPRs, []*models.Branch{branch})
|
||||
pr, hasPr := prs[branch]
|
||||
|
||||
return pr, hasPr
|
||||
|
|
|
|||
|
|
@ -66,7 +66,7 @@ func (gui *Gui) branchesListContext() *ListContext {
|
|||
OnFocus: gui.handleBranchSelect,
|
||||
Gui: gui,
|
||||
GetDisplayStrings: func() [][]string {
|
||||
prs := gui.GitCommand.GenerateGithubPullRequestMap(gui.State.GithubRecentPRs, gui.State.Branches)
|
||||
prs := gui.GitCommand.GenerateGithubPullRequestMap(gui.State.GithubState.RecentPRs, gui.State.Branches)
|
||||
|
||||
return presentation.GetBranchListDisplayStrings(
|
||||
gui.State.Branches,
|
||||
|
|
|
|||
Loading…
Reference in a new issue