feat(inbounds): row action to delete all clients of an inbound

Adds POST /panel/api/inbounds/:id/delAllClients that collects every
client email from settings.clients[] and runs ClientService.BulkDelete
in one pass. Row action lives in the More menu as a danger item, only
shown for multi-user inbounds that currently have at least one client;
confirmation modal displays the live client count.
This commit is contained in:
MHSanaei
2026-05-27 18:17:44 +02:00
parent 93eda06878
commit e23599cb18
17 changed files with 127 additions and 5 deletions
+21
View File
@@ -2415,6 +2415,27 @@ func (s *InboundService) ResetInboundTraffic(id int) error {
})
}
// EmailsByInbound returns the list of client emails currently configured on
// an inbound's settings.clients[]. Used by the "delete all clients" flow on
// the inbounds page, which then feeds the list into ClientService.BulkDelete.
func (s *InboundService) EmailsByInbound(inboundId int) ([]string, error) {
inbound, err := s.GetInbound(inboundId)
if err != nil {
return nil, err
}
clients, err := s.GetClients(inbound)
if err != nil {
return nil, err
}
emails := make([]string, 0, len(clients))
for _, c := range clients {
if e := strings.TrimSpace(c.Email); e != "" {
emails = append(emails, e)
}
}
return emails, nil
}
func (s *InboundService) DelDepletedClients(id int) (err error) {
db := database.GetDB()
tx := db.Begin()