Skip to content

Commit

Permalink
fix(api/list-org-repos): ensure active flag is boolean (#1037)
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.

Co-authored-by: Easton Crupper <65553218+ecrupper@users.noreply.github.com>
  • Loading branch information
wass3r and ecrupper authored Jan 19, 2024
1 parent d79d3a5 commit c3281b4
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 c3281b4

Please sign in to comment.