Skip to content

Commit

Permalink
fix(api/list-org-repos): ensure active flag is boolean
Browse files Browse the repository at this point in the history
closes go-vela/community#853

when GORM is given the proper type, it will use the proper query
depending on which driver is in use.
  • Loading branch information
wass3r committed Jan 14, 2024
1 parent 45f5ad3 commit 22eae27
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions api/repo/list_org.go
Original file line number Diff line number Diff line change
Expand Up @@ -122,11 +122,16 @@ func ListReposForOrg(c *gin.Context) {
// capture the sort_by query parameter if present
sortBy := util.QueryParameter(c, "sort_by", "name")

// prep filters
filters := make(map[string]interface{})

// capture the query parameters if present:
//
// * active
filters := map[string]interface{}{
"active": util.QueryParameter(c, "active", "true"),
active := util.QueryParameter(c, "active", "true")
// ensure active is a boolean and add it to filters as such
if activeBool, err := strconv.ParseBool(active); err == nil {
filters["active"] = activeBool
}

// See if the user is an org admin to bypass individual permission checks
Expand Down

0 comments on commit 22eae27

Please sign in to comment.