From 8de1b76d623df73a0681e1410048ec7e6e586988 Mon Sep 17 00:00:00 2001 From: Kieran Klukas <92754843+kcoderhtml@users.noreply.github.com> Date: Fri, 20 Dec 2024 11:07:05 -0500 Subject: [PATCH] chore: disable clear data button --- routes/settings.go | 36 ++++++++++++++++++++---------------- views/settings.tpl.html | 7 ++++++- 2 files changed, 26 insertions(+), 17 deletions(-) diff --git a/routes/settings.go b/routes/settings.go index 63b46045..d75813cc 100644 --- a/routes/settings.go +++ b/routes/settings.go @@ -707,26 +707,30 @@ func (h *SettingsHandler) actionRegenerateSummaries(w http.ResponseWriter, r *ht } func (h *SettingsHandler) actionClearData(w http.ResponseWriter, r *http.Request) actionResult { - if h.config.IsDev() { - loadTemplates() - } + // return error cannot delete user contact high seas support for help + routeutils.SetError(r, w, "Cannot clear your data. Please contact support for help.") + return actionResult{-1, "", "", nil} - user := middlewares.GetPrincipal(r) - slog.Info("user requested to delete all data", "userID", user.ID) + // if h.config.IsDev() { + // loadTemplates() + // } - go func(user *models.User) { - slog.Info("deleting summaries for user", "userID", user.ID) - if err := h.summarySrvc.DeleteByUser(user.ID); err != nil { - conf.Log().Request(r).Error("failed to clear summaries", "error", err) - } + // user := middlewares.GetPrincipal(r) + // slog.Info("user requested to delete all data", "userID", user.ID) - slog.Info("deleting heartbeats for user", "userID", user.ID) - if err := h.heartbeatSrvc.DeleteByUser(user); err != nil { - conf.Log().Request(r).Error("failed to clear heartbeats", "error", err) - } - }(user) + // go func(user *models.User) { + // slog.Info("deleting summaries for user", "userID", user.ID) + // if err := h.summarySrvc.DeleteByUser(user.ID); err != nil { + // conf.Log().Request(r).Error("failed to clear summaries", "error", err) + // } + + // slog.Info("deleting heartbeats for user", "userID", user.ID) + // if err := h.heartbeatSrvc.DeleteByUser(user); err != nil { + // conf.Log().Request(r).Error("failed to clear heartbeats", "error", err) + // } + // }(user) - return actionResult{http.StatusAccepted, "deletion in progress, this may take a couple of seconds", "", nil} + // return actionResult{http.StatusAccepted, "deletion in progress, this may take a couple of seconds", "", nil} } func (h *SettingsHandler) actionDeleteUser(w http.ResponseWriter, r *http.Request) actionResult { diff --git a/views/settings.tpl.html b/views/settings.tpl.html index 775a3b70..a51edfe1 100644 --- a/views/settings.tpl.html +++ b/views/settings.tpl.html @@ -2107,6 +2107,11 @@ class="font-semibold text-text-primary dark:text-text-dark-primary" >Clear Data + + Warning: Clearing your data is not allowed during high seas. Please contact us in #high-seas-help for more information. + @@ -2117,7 +2122,7 @@