Skip to content

Commit

Permalink
fix: add featuring libraries to resident view when library is feature…
Browse files Browse the repository at this point in the history
…d per UnlockedLabs#592 and display featured content to other admins per UnlockedLabs#629
  • Loading branch information
carddev81 committed Jan 7, 2025
1 parent 9b33dba commit f2952cf
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions backend/src/handlers/libraries_handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,13 @@ func (srv *Server) handleIndexLibraries(w http.ResponseWriter, r *http.Request,
showHidden := "visible"
if !userIsAdmin(r) && r.URL.Query().Get("visibility") == "hidden" {
return newUnauthorizedServiceError()
}
if userIsAdmin(r) {
} else if !userIsAdmin(r) && r.URL.Query().Get("visibility") == "featured" {
showHidden = "featured"
} else if userIsAdmin(r) {
showHidden = r.URL.Query().Get("visibility")
}
claims := r.Context().Value(ClaimsKey).(*Claims)
total, libraries, err := srv.Db.GetAllLibraries(page, perPage, claims.UserID, claims.FacilityID, showHidden, orderBy, search, days)
total, libraries, err := srv.Db.GetAllLibraries(page, perPage, days, claims.UserID, claims.FacilityID, showHidden, orderBy, search, claims.isAdmin())
if err != nil {
return newDatabaseServiceError(err)
}
Expand Down

0 comments on commit f2952cf

Please sign in to comment.