diff --git a/pkg/gui/controllers/helpers/update_helper.go b/pkg/gui/controllers/helpers/update_helper.go index b58c7b34f..508253fd2 100644 --- a/pkg/gui/controllers/helpers/update_helper.go +++ b/pkg/gui/controllers/helpers/update_helper.go @@ -307,6 +307,8 @@ func (self *UpdateHelper) updateMenuOptions(newVersion *types.VersionNumber) typ }, }, ) + paragraphs = append(paragraphs, self.c.Tr.TurnOffUpdateReminders) + // Whatever the user chooses counts as a response, and so does closing the // menu for _, item := range items { diff --git a/pkg/i18n/english.go b/pkg/i18n/english.go index 83fd9c907..c0e750df8 100644 --- a/pkg/i18n/english.go +++ b/pkg/i18n/english.go @@ -291,6 +291,7 @@ type TranslationSet struct { RestartToUseNewVersion string RemindMeTomorrow string SkipThisVersion string + TurnOffUpdateReminders string IntroPopupMessage string NonReloadableConfigWarningTitle string NonReloadableConfigWarning string @@ -1529,6 +1530,7 @@ func EnglishTranslationSet() *TranslationSet { RestartToUseNewVersion: "Restart to use {{.newVersion}}", RemindMeTomorrow: "Remind me tomorrow", SkipThisVersion: "Skip this version", + TurnOffUpdateReminders: "To turn off these reminders, set update.method to never in your config file.", IntroPopupMessage: englishIntroPopupMessage, NonReloadableConfigWarningTitle: "Config changed", NonReloadableConfigWarning: englishNonReloadableConfigWarning, diff --git a/pkg/updates/updates.go b/pkg/updates/updates.go index cb3a4709d..936e15183 100644 --- a/pkg/updates/updates.go +++ b/pkg/updates/updates.go @@ -256,6 +256,13 @@ func (u *Updater) IsStartingUp() bool { return u.now().Sub(u.startTime) < startupPeriod } +// RemindersEnabled returns whether lazygit reminds the user of available +// updates. With update.method set to never, it only shows the note in the +// bottom-right corner. +func (u *Updater) RemindersEnabled() bool { + return u.ChecksEnabled() && u.UserConfig().Update.Method != "never" +} + // DueReminder returns the version to remind the user of, or nil if no reminder // is due func (u *Updater) DueReminder(reminder Reminder) *types.VersionNumber { @@ -263,7 +270,7 @@ func (u *Updater) DueReminder(reminder Reminder) *types.VersionNumber { } func (u *Updater) dueReminder(state *config.AppState, reminder Reminder) *types.VersionNumber { - if !u.ChecksEnabled() { + if !u.RemindersEnabled() { return nil } diff --git a/pkg/updates/updates_test.go b/pkg/updates/updates_test.go index d624d7fa2..2f52e744a 100644 --- a/pkg/updates/updates_test.go +++ b/pkg/updates/updates_test.go @@ -351,7 +351,7 @@ func TestIsHandledAfter(t *testing.T) { assert.True(t, updater.IsHandledAfter(shownAt)) } -func TestRemindersAreOffWhenChecksAre(t *testing.T) { +func TestRemindersAreOffWithUpdateMethodNever(t *testing.T) { updater := newTestUpdater(t, nil, "0.66.2", Installation{Kind: InstallKindRelease, ExecutablePath: "/bin/lazygit"}) updater.appState.(*fakeAppStateStore).state.Updates = config.UpdatesState{LatestVersion: "v0.67.0"} updater.UserConfig().Update.Method = "never"