Skip to content

Commit

Permalink
fix: prevent duplicate models in user group retrieval
Browse files Browse the repository at this point in the history
  • Loading branch information
Calcium-Ion committed Dec 27, 2024
1 parent 77861e6 commit 1cef91a
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion controller/user.go
Original file line number Diff line number Diff line change
Expand Up @@ -458,7 +458,11 @@ func GetUserModels(c *gin.Context) {
groups := setting.GetUserUsableGroups(user.Group)
var models []string
for group := range groups {
models = append(models, model.GetGroupModels(group)...)
for _, g := range model.GetGroupModels(group) {
if !common.StringsContains(models, g) {
models = append(models, g)
}
}
}
c.JSON(http.StatusOK, gin.H{
"success": true,
Expand Down

0 comments on commit 1cef91a

Please sign in to comment.