Skip to content

Commit 1db2fc0

Browse files
feat: reenable the delete button
1 parent eb32797 commit 1db2fc0

File tree

2 files changed

+19
-29
lines changed

2 files changed

+19
-29
lines changed

routes/settings.go

Lines changed: 17 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -734,29 +734,25 @@ func (h *SettingsHandler) actionClearData(w http.ResponseWriter, r *http.Request
734734
}
735735

736736
func (h *SettingsHandler) actionDeleteUser(w http.ResponseWriter, r *http.Request) actionResult {
737-
// return error cannot delete user contact high seas support for help
738-
routeutils.SetError(r, w, "Cannot delete user. Please contact support for help.")
739-
return actionResult{-1, "", "", nil}
740-
741-
// if h.config.IsDev() {
742-
// loadTemplates()
743-
// }
737+
if h.config.IsDev() {
738+
loadTemplates()
739+
}
744740

745-
// user := middlewares.GetPrincipal(r)
746-
// go func(user *models.User) {
747-
// slog.Info("deleting user shortly", "userID", user.ID)
748-
// time.Sleep(5 * time.Minute)
749-
// if err := h.userSrvc.Delete(user); err != nil {
750-
// conf.Log().Request(r).Error("failed to delete user", "userID", user.ID, "error", err)
751-
// } else {
752-
// slog.Info("successfully deleted user", "userID", user.ID)
753-
// }
754-
// }(user)
741+
user := middlewares.GetPrincipal(r)
742+
go func(user *models.User) {
743+
slog.Info("deleting user shortly", "userID", user.ID)
744+
time.Sleep(5 * time.Minute)
745+
if err := h.userSrvc.Delete(user); err != nil {
746+
conf.Log().Request(r).Error("failed to delete user", "userID", user.ID, "error", err)
747+
} else {
748+
slog.Info("successfully deleted user", "userID", user.ID)
749+
}
750+
}(user)
755751

756-
// routeutils.SetSuccess(r, w, "Your account will be deleted in a few minutes. Sorry to see you go.")
757-
// http.SetCookie(w, h.config.GetClearCookie(models.AuthCookieKey))
758-
// http.Redirect(w, r, h.config.Server.BasePath, http.StatusFound)
759-
// return actionResult{-1, "", "", nil}
752+
routeutils.SetSuccess(r, w, "Your account will be deleted in a few minutes. Sorry to see you go.")
753+
http.SetCookie(w, h.config.GetClearCookie(models.AuthCookieKey))
754+
http.Redirect(w, r, h.config.Server.BasePath, http.StatusFound)
755+
return actionResult{-1, "", "", nil}
760756
}
761757

762758
func (h *SettingsHandler) actionGenerateInvite(w http.ResponseWriter, r *http.Request) actionResult {

views/settings.tpl.html

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2147,12 +2147,7 @@
21472147
class="font-semibold text-text-primary dark:text-text-dark-primary"
21482148
>Delete Account</span
21492149
>
2150-
<span
2151-
class="block text-sm text-red-600"
2152-
>
2153-
Warning: Deleting your account is currently disabled during High Seas. Please contact us in <a href="https://hackclub.slack.com/archives/C07PZNMBPBN">#high-seas-help</a>
2154-
</span>
2155-
<br/>
2150+
21562151
<span
21572152
class="block text-sm text-text-secondary dark:text-text-dark-secondary"
21582153
>
@@ -2165,9 +2160,8 @@
21652160
<div class="w-1/2 ml-4 flex items-center">
21662161
<button
21672162
type="button"
2168-
class="btn-danger ml-1 opacity-50 cursor-not-allowed"
2163+
class="btn-danger ml-1"
21692164
@click.stop="confirmDeleteAccount"
2170-
disabled
21712165
>
21722166
Delete account
21732167
</button>

0 commit comments

Comments
 (0)