diff --git a/pkg/gui/branches_panel.go b/pkg/gui/branches_panel.go index 7490ff23f..4b9a8b573 100644 --- a/pkg/gui/branches_panel.go +++ b/pkg/gui/branches_panel.go @@ -101,9 +101,7 @@ func (gui *Gui) handleBranchPress() error { func (gui *Gui) handleCreateOrShowPullRequestPress() error { branch := gui.getSelectedBranch() - - prs, _ := gui.GitCommand.GenerateGithubPullRequestMap(gui.State.GithubRecentPRs, []*models.Branch{branch}) - pr, hasPr := prs[branch] + pr, hasPr := gui.GetPr(branch) if hasPr { return gui.OSCommand.OpenLink(pr.Url) diff --git a/pkg/gui/gui.go b/pkg/gui/gui.go index eb84b4810..ba8af1108 100644 --- a/pkg/gui/gui.go +++ b/pkg/gui/gui.go @@ -731,3 +731,10 @@ func (gui *Gui) setColorScheme() error { return nil } + +func (gui *Gui) GetPr(branch *models.Branch) (*models.GithubPullRequest, bool) { + prs, _ := gui.GitCommand.GenerateGithubPullRequestMap(gui.State.GithubRecentPRs, []*models.Branch{branch}) + pr, hasPr := prs[branch] + + return pr, hasPr +} diff --git a/pkg/gui/pull_request_menu_panel.go b/pkg/gui/pull_request_menu_panel.go index e3115d7e2..023acf1f8 100644 --- a/pkg/gui/pull_request_menu_panel.go +++ b/pkg/gui/pull_request_menu_panel.go @@ -39,12 +39,11 @@ func (gui *Gui) createOrOpenPullRequestMenu(selectedBranch *models.Branch, check } } - prs, _ := gui.GitCommand.GenerateGithubPullRequestMap(gui.State.GithubRecentPRs, []*models.Branch{selectedBranch}) - pr, hasPr := prs[selectedBranch] + pr, hasPr := gui.GetPr(selectedBranch) if hasPr { menuItems = append(menuItems, &menuItem{ - displayString: gui.GitCommand.Tr.OpenPr + strconv.Itoa(pr.Number), + displayString: gui.GitCommand.Tr.MustSpecifyOriginError + strconv.Itoa(pr.Number), onPress: func() error { return gui.OSCommand.OpenLink(pr.Url) },