From a6b34440685435141dab6831009b345efdedf489 Mon Sep 17 00:00:00 2001 From: Sebastian Mark Date: Wed, 23 Oct 2024 17:35:16 +0200 Subject: [PATCH] refactor: better check for empty pomodoro client settings MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - replace UnsetPomodoroConfig with empty struct check in client commands - remove unused UnsetPomodoroConfig variable 🤖 --- internal/shared/configDefaults.go | 3 --- internal/websocket/client_commands.go | 2 +- 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/internal/shared/configDefaults.go b/internal/shared/configDefaults.go index ba4be6c..b4b82ff 100644 --- a/internal/shared/configDefaults.go +++ b/internal/shared/configDefaults.go @@ -15,6 +15,3 @@ var DefaultPomodoroConfig = models.GoTomatoPomodoroConfig{ LongBreak: 15 * 60, Sessions: 4, } - -// used to check if client passed a config json -var UnsetPomodoroConfig models.GoTomatoPomodoroConfig diff --git a/internal/websocket/client_commands.go b/internal/websocket/client_commands.go index 0687046..67a917d 100644 --- a/internal/websocket/client_commands.go +++ b/internal/websocket/client_commands.go @@ -49,7 +49,7 @@ func handleClientCommands(ws *websocket.Conn) { } case "updateSettings": if !pomodoro.IsPomodoroOngoing() { - if clientCommand.PomodoroSettings != shared.UnsetPomodoroConfig { + if clientCommand.PomodoroSettings != (models.GoTomatoPomodoroConfig{}) { shared.Message.PomodoroSettings = clientCommand.PomodoroSettings shared.Message.TimeLeft = clientCommand.PomodoroSettings.Work }