mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2026-11-06 21:25:04 +03:00
fix(clients): store client group names trimmed
The groups page lists clients.group_name as stored, while every group action trims the name it is given. A name with surrounding white space, saved by a node snapshot or by a client edit, was listed as a separate group, and deleting, renaming or resetting that row acted on the real group of the trimmed name instead. Group names are trimmed wherever a client record is built or updated, and a one-time seeder folds stored names onto their trimmed form.
This commit is contained in:
@@ -923,7 +923,7 @@ func (s *ClientService) Update(inboundSvc *InboundService, id int, updated model
|
||||
// including the empty string that removes the client from its group.
|
||||
if err := database.GetDB().Model(&model.ClientRecord{}).
|
||||
Where("id = ?", id).
|
||||
UpdateColumn("group_name", updated.Group).Error; err != nil {
|
||||
UpdateColumn("group_name", strings.TrimSpace(updated.Group)).Error; err != nil {
|
||||
return needRestart, err
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user