From 78767c082e1b6d0435aadc06ea4287c69415a8b7 Mon Sep 17 00:00:00 2001 From: Sora39831 <540587985@qq.com> Date: Sat, 4 Apr 2026 22:35:33 +0800 Subject: [PATCH] feat(users): cascade delete user-owned inbounds when deleting user --- web/controller/user.go | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/web/controller/user.go b/web/controller/user.go index 6e3ccb07..dcbd3454 100644 --- a/web/controller/user.go +++ b/web/controller/user.go @@ -105,6 +105,18 @@ func (a *UserController) deleteUser(c *gin.Context) { } currentUser := session.GetLoginUser(c) + inbounds, err := a.inboundService.GetInbounds(id) + if err != nil { + jsonMsg(c, I18nWeb(c, "pages.users.toasts.delete"), err) + return + } + for _, inbound := range inbounds { + if _, err := a.inboundService.DelInbound(inbound.Id); err != nil { + jsonMsg(c, I18nWeb(c, "pages.users.toasts.delete"), err) + return + } + } + err = a.userService.DeleteUser(id, currentUser.Id) if err != nil { jsonMsg(c, I18nWeb(c, "pages.users.toasts.delete"), a.localizeUserError(c, err))